-
Notifications
You must be signed in to change notification settings - Fork 3.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
hotfix/PyWry Linux Wheels-Import Error Handing #4561
Merged
jmaslek
merged 16 commits into
OpenBB-finance:develop
from
tehcoderer:hotfix/pywry-charts
Mar 23, 2023
Merged
Changes from 6 commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
4ed9a71
init
tehcoderer 733fc12
Merge branch 'develop' into hotfix/pywry-charts
tehcoderer fa58133
Update openbb.dockerfile
tehcoderer fa75892
Merge branch 'hotfix/pywry-charts' of https://github.com/tehcoderer/O…
tehcoderer e528448
Merge branch 'develop' into hotfix/pywry-charts
tehcoderer 9e6e1a8
fixing linting
andrewkenreich db07415
req files CLI update
tehcoderer 165a635
bump pywry
tehcoderer 51abed9
new width/weight env vars for pywry specifically
tehcoderer 8ce0427
Update backend.py
tehcoderer 723af0e
Merge branch 'OpenBBTerminal-main' into hotfix/pywry-charts
tehcoderer eabdd99
req files
tehcoderer 756e17d
Update backend.py
tehcoderer d41eb19
Merge branch 'develop' into hotfix/pywry-charts
jmaslek e35c9ac
last bump pywry 0.4.0
tehcoderer 65cc244
Update dashboards_controller.py
tehcoderer File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,6 +4,7 @@ logs/ | |
.DS_Store | ||
*.env | ||
.venv | ||
venv*/ | ||
venv | ||
.vscode | ||
*.ipynb | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
import asyncio | ||
from typing import List | ||
|
||
import dotenv | ||
|
||
from openbb_terminal.base_helpers import console | ||
from openbb_terminal.core.config.paths import SETTINGS_ENV_FILE | ||
from openbb_terminal.core.session.current_user import get_current_user | ||
|
||
__version__ = "0.0.0" | ||
|
||
pywry_missing = """ | ||
[red]PyWry is not installed or missing required linux dependencies.[/] | ||
|
||
[yellow]Install PyWry[/] | ||
[green]pip install pywry --upgrade[/] | ||
|
||
[yellow]Platform-specific notes[/] | ||
Here is the underlying web engine each platform uses you might need to install. | ||
|
||
[green]Linux[/] | ||
Pywry uses gtk-rs and its related libraries for window creation and Wry also needs WebKitGTK for WebView. | ||
To activate interactive plots/tables in pywry window, please make sure the following packages are installed: | ||
|
||
[yellow]Arch Linux / Manjaro:[/] | ||
[green]sudo pacman -S webkit2gtk-4.0[/]\n | ||
[yellow]Debian / Ubuntu:[/] | ||
[green]sudo apt install libwebkit2gtk-4.0-dev[/]\n | ||
[yellow]Fedora / CentOS / AlmaLinux:[/] | ||
[green]sudo dnf install gtk3-devel webkit2gtk4.0-devel[/]\r | ||
""" | ||
|
||
|
||
class PyWry: | ||
"""Dummy class to avoid import errors.""" | ||
|
||
max_retries = 0 | ||
outgoing: List[str] = [] | ||
init_engine: List[str] = [] | ||
daemon = True | ||
debug = False | ||
shell = False | ||
base = None | ||
|
||
try: | ||
loop: asyncio.AbstractEventLoop = asyncio.get_event_loop() | ||
except RuntimeError: | ||
loop = asyncio.new_event_loop() | ||
asyncio.set_event_loop(loop) | ||
|
||
def __init__(self, *args, **kwargs): # pylint: disable=W0613 | ||
"""Dummy init to avoid import errors.""" | ||
current_user = get_current_user() | ||
|
||
# If pywry is not installed or missing required linux dependencies | ||
# we inform the user the required packages to install and revert | ||
# plotly default behaviour to open in browser. | ||
# We do this only once. | ||
if current_user.preferences.PLOT_ENABLE_PYWRY: | ||
console.print(pywry_missing) | ||
if console.input( | ||
"If you prefer to continue without interactive plots/tables, " | ||
"press [green]enter[/] or [red]ctrl+c[/] to exit." | ||
): | ||
dotenv.set_key(SETTINGS_ENV_FILE, "PLOT_ENABLE_PYWRY", "0") | ||
|
||
current_user.preferences.USE_INTERACTIVE_DF = False | ||
|
||
def close(self, *args, **kwargs): # pylint: disable=W0613 | ||
"""Dummy method to avoid errors.""" | ||
|
||
def start(self, debug: bool = False): # pylint: disable=W0613 | ||
"""Dummy method to avoid errors.""" | ||
|
||
async def check_backend(self): | ||
"""Dummy check backend method to avoid errors and revert to browser.""" | ||
raise Exception |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nice