From 07d9ed2c9e8008d0a3934ec0a542454dcbaeec81 Mon Sep 17 00:00:00 2001 From: James Maslek Date: Tue, 18 Apr 2023 16:20:58 -0400 Subject: [PATCH] Feature/featflags destroy (#4822) * Remove ION from prefs * Remove featflag rich * remove cmdloc and watermark * remove color featflag --- .github/workflows/build-release.yml | 7 ++- .github/workflows/linting.yml | 1 - .github/workflows/macos-build.yml | 1 - .github/workflows/macos-ml.yml | 1 - .github/workflows/nightly-build.yml | 1 - .github/workflows/unit-test.yml | 1 - .github/workflows/windows10_build.yml | 1 - .github/workflows/windows_ml.yml | 1 - .../integration_controller.py | 1 - .../core/models/preferences_model.py | 5 --- openbb_terminal/core/plots/plotly_helper.py | 6 +-- openbb_terminal/featflags_controller.py | 43 ------------------- openbb_terminal/helper_classes.py | 12 ++---- openbb_terminal/helper_funcs.py | 4 +- .../account/test_account_controller.py | 1 - .../test_finbrain_view.py | 4 +- .../economy/test_finviz_view.py | 3 -- .../session/test_session_model.py | 1 - .../test_featflags_controller.py | 20 --------- .../test_terminal_controller.py | 2 - 20 files changed, 11 insertions(+), 105 deletions(-) diff --git a/.github/workflows/build-release.yml b/.github/workflows/build-release.yml index 2bbdd1f2e0b..7c40db08b24 100644 --- a/.github/workflows/build-release.yml +++ b/.github/workflows/build-release.yml @@ -3,7 +3,6 @@ name: Build & Release env: OPENBB_ENABLE_QUICK_EXIT: true OPENBB_LOG_COLLECT: false - OPENBB_USE_ION: false OPENBB_USE_PROMPT_TOOLKIT: false PIP_DEFAULT_TIMEOUT: 100 PYTHONNOUSERSITE: 1 @@ -18,7 +17,7 @@ concurrency: group: ${{ github.workflow }}-${{ github.ref }} cancel-in-progress: true -permissions: +permissions: actions: write jobs: @@ -31,7 +30,7 @@ jobs: workflow: windows10_build.yml token: ${{ secrets.GITHUB_TOKEN }} wait-for-completion-timeout: 2h - + trigger-macos-build: runs-on: ubuntu-latest steps: @@ -41,7 +40,7 @@ jobs: workflow: macos-build.yml token: ${{ secrets.GITHUB_TOKEN }} wait-for-completion-timeout: 2h - + trigger-docker-build: runs-on: ubuntu-latest steps: diff --git a/.github/workflows/linting.yml b/.github/workflows/linting.yml index 415b068ab61..b16ac9ffd76 100644 --- a/.github/workflows/linting.yml +++ b/.github/workflows/linting.yml @@ -3,7 +3,6 @@ name: General Linting env: OPENBB_ENABLE_QUICK_EXIT: true OPENBB_LOG_COLLECT: false - OPENBB_USE_ION: false OPENBB_USE_PROMPT_TOOLKIT: false OPENBB_FILE_OVERWRITE: true PIP_DEFAULT_TIMEOUT: 100 diff --git a/.github/workflows/macos-build.yml b/.github/workflows/macos-build.yml index 547e02e4527..a74b5378073 100644 --- a/.github/workflows/macos-build.yml +++ b/.github/workflows/macos-build.yml @@ -2,7 +2,6 @@ name: MacOS Build env: OPENBB_LOG_COLLECT: false - OPENBB_USE_ION: false OPENBB_USE_PROMPT_TOOLKIT: false OPENBB_FILE_OVERWRITE: true PIP_DEFAULT_TIMEOUT: 100 diff --git a/.github/workflows/macos-ml.yml b/.github/workflows/macos-ml.yml index 2bca5fa0910..f11f5502fc4 100644 --- a/.github/workflows/macos-ml.yml +++ b/.github/workflows/macos-ml.yml @@ -2,7 +2,6 @@ name: Mac OS X Full Clean Build with ML env: OPENBB_ENABLE_QUICK_EXIT: true OPENBB_LOG_COLLECT: false - OPENBB_USE_ION: false OPENBB_USE_PROMPT_TOOLKIT: false PIP_DEFAULT_TIMEOUT: 100 OPENBB_FILE_OVERWRITE: true diff --git a/.github/workflows/nightly-build.yml b/.github/workflows/nightly-build.yml index 9e0a06275b0..07bf7355543 100644 --- a/.github/workflows/nightly-build.yml +++ b/.github/workflows/nightly-build.yml @@ -3,7 +3,6 @@ name: Nightly Build env: OPENBB_ENABLE_QUICK_EXIT: true OPENBB_LOG_COLLECT: false - OPENBB_USE_ION: false OPENBB_USE_PROMPT_TOOLKIT: false PIP_DEFAULT_TIMEOUT: 100 OPENBB_FILE_OVERWRITE: true diff --git a/.github/workflows/unit-test.yml b/.github/workflows/unit-test.yml index e6b410945a5..26e24de25af 100644 --- a/.github/workflows/unit-test.yml +++ b/.github/workflows/unit-test.yml @@ -3,7 +3,6 @@ name: Unit Test env: OPENBB_ENABLE_QUICK_EXIT: true OPENBB_LOG_COLLECT: false - OPENBB_USE_ION: false OPENBB_USE_PROMPT_TOOLKIT: false OPENBB_FILE_OVERWRITE: true OPENBB_ENABLE_CHECK_API: false diff --git a/.github/workflows/windows10_build.yml b/.github/workflows/windows10_build.yml index ab1cf2cdd74..17c3431b957 100644 --- a/.github/workflows/windows10_build.yml +++ b/.github/workflows/windows10_build.yml @@ -3,7 +3,6 @@ name: Windows10 Build env: OPENBB_ENABLE_QUICK_EXIT: true OPENBB_LOG_COLLECT: false - OPENBB_USE_ION: false OPENBB_USE_PROMPT_TOOLKIT: false PIP_DEFAULT_TIMEOUT: 100 PYTHONNOUSERSITE: 1 diff --git a/.github/workflows/windows_ml.yml b/.github/workflows/windows_ml.yml index 2c87ca07e90..3d5663a2d47 100644 --- a/.github/workflows/windows_ml.yml +++ b/.github/workflows/windows_ml.yml @@ -2,7 +2,6 @@ name: Windows 10 Full Clean Build with ML env: OPENBB_ENABLE_QUICK_EXIT: true OPENBB_LOG_COLLECT: false - OPENBB_USE_ION: false OPENBB_USE_PROMPT_TOOLKIT: false OPENBB_FILE_OVERWRITE: true PIP_DEFAULT_TIMEOUT: 100 diff --git a/openbb_terminal/core/integration_tests/integration_controller.py b/openbb_terminal/core/integration_tests/integration_controller.py index 95618154c82..b92b2d659a7 100644 --- a/openbb_terminal/core/integration_tests/integration_controller.py +++ b/openbb_terminal/core/integration_tests/integration_controller.py @@ -750,7 +750,6 @@ def main(): # user current_user = get_current_user() current_user.preferences.ENABLE_EXIT_AUTO_HELP = False - current_user.preferences.USE_ION = True current_user.preferences.USE_PROMPT_TOOLKIT = False current_user.preferences.REMEMBER_CONTEXTS = False current_user.preferences.PLOT_ENABLE_PYWRY = False diff --git a/openbb_terminal/core/models/preferences_model.py b/openbb_terminal/core/models/preferences_model.py index 3fba68bdc59..016299be198 100644 --- a/openbb_terminal/core/models/preferences_model.py +++ b/openbb_terminal/core/models/preferences_model.py @@ -45,12 +45,8 @@ class PreferencesModel(BaseModel): # Use interactive window to display dataframes with options to sort, filter, etc. USE_INTERACTIVE_DF: bool = True USE_CLEAR_AFTER_CMD: bool = False - USE_COLOR: bool = True USE_DATETIME: bool = True # Enable interactive matplotlib mode: change variable name to be more descriptive and delete comment - USE_ION: bool = True - USE_WATERMARK: bool = True - USE_CMD_LOCATION_FIGURE: bool = True USE_PROMPT_TOOLKIT: bool = True USE_PLOT_AUTOSCALING: bool = False ENABLE_THOUGHTS_DAY: bool = False @@ -58,7 +54,6 @@ class PreferencesModel(BaseModel): OPEN_REPORT_AS_HTML: bool = True ENABLE_EXIT_AUTO_HELP: bool = True REMEMBER_CONTEXTS: bool = True - ENABLE_RICH: bool = True ENABLE_RICH_PANEL: bool = True ENABLE_CHECK_API: bool = True TOOLBAR_HINT: bool = True diff --git a/openbb_terminal/core/plots/plotly_helper.py b/openbb_terminal/core/plots/plotly_helper.py index 16719050989..03b6e2438d9 100644 --- a/openbb_terminal/core/plots/plotly_helper.py +++ b/openbb_terminal/core/plots/plotly_helper.py @@ -1634,10 +1634,8 @@ class OpenBBFigure(go.Figure): if self._feature_flags_applied: return - if get_current_user().preferences.USE_CMD_LOCATION_FIGURE: - self._add_cmd_source() - if get_current_user().preferences.USE_WATERMARK: - self._set_watermark() + self._add_cmd_source() + self._set_watermark() self._feature_flags_applied = True diff --git a/openbb_terminal/featflags_controller.py b/openbb_terminal/featflags_controller.py index 8cefa5d7afc..0f0100529a8 100644 --- a/openbb_terminal/featflags_controller.py +++ b/openbb_terminal/featflags_controller.py @@ -48,16 +48,12 @@ class FeatureFlagsController(BaseController): "tab", "interactive", "cls", - "color", - "ion", "watermark", - "cmdloc", "promptkit", "thoughts", "reporthtml", "exithelp", "rcontext", - "rich", "richpanel", "tbhint", "overwrite", @@ -84,17 +80,12 @@ class FeatureFlagsController(BaseController): mt.add_setting("tab", current_user.preferences.USE_TABULATE_DF) mt.add_setting("interactive", current_user.preferences.USE_INTERACTIVE_DF) mt.add_setting("cls", current_user.preferences.USE_CLEAR_AFTER_CMD) - mt.add_setting("color", current_user.preferences.USE_COLOR) mt.add_setting("promptkit", current_user.preferences.USE_PROMPT_TOOLKIT) mt.add_setting("thoughts", current_user.preferences.ENABLE_THOUGHTS_DAY) mt.add_setting("reporthtml", current_user.preferences.OPEN_REPORT_AS_HTML) mt.add_setting("exithelp", current_user.preferences.ENABLE_EXIT_AUTO_HELP) mt.add_setting("rcontext", current_user.preferences.REMEMBER_CONTEXTS) - mt.add_setting("rich", current_user.preferences.ENABLE_RICH) mt.add_setting("richpanel", current_user.preferences.ENABLE_RICH_PANEL) - mt.add_setting("ion", current_user.preferences.USE_ION) - mt.add_setting("watermark", current_user.preferences.USE_WATERMARK) - mt.add_setting("cmdloc", current_user.preferences.USE_CMD_LOCATION_FIGURE) mt.add_setting("tbhint", current_user.preferences.TOOLBAR_HINT) mt.add_setting("overwrite", current_user.preferences.FILE_OVERWRITE) mt.add_setting("version", current_user.preferences.SHOW_VERSION) @@ -141,13 +132,6 @@ class FeatureFlagsController(BaseController): not get_current_user().preferences.USE_CLEAR_AFTER_CMD, ) - @log_start_end(log=logger) - def call_color(self, _): - """Process color command""" - set_and_save_preference( - "USE_COLOR", not get_current_user().preferences.USE_COLOR - ) - @log_start_end(log=logger) def call_promptkit(self, _): """Process promptkit command""" @@ -195,13 +179,6 @@ class FeatureFlagsController(BaseController): "USE_DATETIME", not get_current_user().preferences.USE_DATETIME ) - @log_start_end(log=logger) - def call_rich(self, _): - """Process rich command""" - set_and_save_preference( - "ENABLE_RICH", not get_current_user().preferences.ENABLE_RICH - ) - @log_start_end(log=logger) def call_richpanel(self, _): """Process richpanel command""" @@ -210,26 +187,6 @@ class FeatureFlagsController(BaseController): not get_current_user().preferences.ENABLE_RICH_PANEL, ) - @log_start_end(log=logger) - def call_ion(self, _): - """Process ion command""" - set_and_save_preference("USE_ION", not get_current_user().preferences.USE_ION) - - @log_start_end(log=logger) - def call_watermark(self, _): - """Process watermark command""" - set_and_save_preference( - "USE_WATERMARK", not get_current_user().preferences.USE_WATERMARK - ) - - @log_start_end(log=logger) - def call_cmdloc(self, _): - """Process cmdloc command""" - set_and_save_preference( - "USE_CMD_LOCATION_FIGURE", - not get_current_user().preferences.USE_CMD_LOCATION_FIGURE, - ) - @log_start_end(log=logger) def call_tbhint(self, _): """Process tbhint command""" diff --git a/openbb_terminal/helper_classes.py b/openbb_terminal/helper_classes.py index a932e2fce95..b971afe14df 100644 --- a/openbb_terminal/helper_classes.py +++ b/openbb_terminal/helper_classes.py @@ -351,12 +351,10 @@ class TerminalStyle: self, force_tight_layout: bool = True, external_axes: bool = False ): """Show chart in an interactive widget.""" - current_user = get_current_user() - if current_user.preferences.USE_CMD_LOCATION_FIGURE: - self.add_cmd_source(plt.gcf()) - if current_user.preferences.USE_WATERMARK: - self.add_label(plt.gcf()) + self.add_cmd_source(plt.gcf()) + self.add_label(plt.gcf()) + if force_tight_layout: plt.tight_layout(pad=self.tight_layout_padding) @@ -375,12 +373,8 @@ class TerminalStyle: height=im.height, ) else: - if current_user.preferences.USE_ION: - plt.ion() - fig = None plt.show() - return fig diff --git a/openbb_terminal/helper_funcs.py b/openbb_terminal/helper_funcs.py index a046e0ab414..5cbb2549a01 100644 --- a/openbb_terminal/helper_funcs.py +++ b/openbb_terminal/helper_funcs.py @@ -72,8 +72,6 @@ MENU_GO_BACK = 0 MENU_QUIT = 1 MENU_RESET = 2 -LAST_TWEET_NEWS_UPDATE_CHECK_TIME = None - # Command location path to be shown in the figures depending on watermark flag command_location = "" @@ -339,7 +337,7 @@ def print_rich_table( return df = df.copy() if not limit else df.copy().iloc[:limit] - if current_user.preferences.USE_COLOR and automatic_coloring: + if automatic_coloring: if columns_to_auto_color: for col in columns_to_auto_color: # checks whether column exists diff --git a/tests/openbb_terminal/account/test_account_controller.py b/tests/openbb_terminal/account/test_account_controller.py index 1ad58884737..8fbc384e12c 100644 --- a/tests/openbb_terminal/account/test_account_controller.py +++ b/tests/openbb_terminal/account/test_account_controller.py @@ -32,7 +32,6 @@ TEST_SESSION = { CONFIGS = { "features_settings": { - "USE_WATERMARK": "False", "TIMEZONE": "Europe/London", "PLOT_DPI": "95", "PLOT_HEIGHT_PERCENTAGE": "50.5", diff --git a/tests/openbb_terminal/common/behavioural_analysis/test_finbrain_view.py b/tests/openbb_terminal/common/behavioural_analysis/test_finbrain_view.py index 52bca8a12cb..5eceeb2ec36 100644 --- a/tests/openbb_terminal/common/behavioural_analysis/test_finbrain_view.py +++ b/tests/openbb_terminal/common/behavioural_analysis/test_finbrain_view.py @@ -25,7 +25,7 @@ def test_display_sentiment_analysis(color, mocker): ) # MOCK OBBFF - preferences = PreferencesModel(USE_ION=True) + preferences = PreferencesModel() mock_current_user = copy_user(preferences=preferences) mocker.patch( target="openbb_terminal.core.session.current_user.__current_user", @@ -52,7 +52,7 @@ def test_display_sentiment_analysis_empty_df(mocker): ) # MOCK OBBFF - preferences = PreferencesModel(USE_ION=True) + preferences = PreferencesModel() mock_current_user = copy_user(preferences=preferences) mocker.patch( target="openbb_terminal.core.session.current_user.__current_user", diff --git a/tests/openbb_terminal/economy/test_finviz_view.py b/tests/openbb_terminal/economy/test_finviz_view.py index 1c3cfbe3d09..7f3231e1bbb 100644 --- a/tests/openbb_terminal/economy/test_finviz_view.py +++ b/tests/openbb_terminal/economy/test_finviz_view.py @@ -33,7 +33,6 @@ def test_display_valuation(mocker, tab): # MOCK OBBFF preferences = PreferencesModel( USE_TABULATE_DF=tab, - USE_ION=True, ) mock_current_user = copy_user(preferences=preferences) mocker.patch( @@ -66,7 +65,6 @@ def test_display_performance(mocker, tab): # MOCK OBBFF preferences = PreferencesModel( USE_TABULATE_DF=tab, - USE_ION=True, ) mock_current_user = copy_user(preferences=preferences) mocker.patch( @@ -99,7 +97,6 @@ def test_display_future(mocker, tab): # MOCK OBBFF preferences = PreferencesModel( USE_TABULATE_DF=tab, - USE_ION=True, ) mock_current_user = copy_user(preferences=preferences) mocker.patch( diff --git a/tests/openbb_terminal/session/test_session_model.py b/tests/openbb_terminal/session/test_session_model.py index f38cbd606bf..c4e09c8ff91 100644 --- a/tests/openbb_terminal/session/test_session_model.py +++ b/tests/openbb_terminal/session/test_session_model.py @@ -20,7 +20,6 @@ TEST_SESSION = { CONFIGS = { "features_settings": { - "USE_WATERMARK": "False", "TIMEZONE": "Europe/London", "PLOT_DPI": "95", "PLOT_HEIGHT_PERCENTAGE": "50.5", diff --git a/tests/openbb_terminal/test_featflags_controller.py b/tests/openbb_terminal/test_featflags_controller.py index 681d8e24dd8..1ed75da1a9c 100644 --- a/tests/openbb_terminal/test_featflags_controller.py +++ b/tests/openbb_terminal/test_featflags_controller.py @@ -42,10 +42,6 @@ def test_call_cls(controller): controller.call_cls(None) -def test_call_color(controller): - controller.call_color(None) - - def test_call_promptkit(controller): controller.call_promptkit(None) @@ -66,21 +62,5 @@ def test_call_rcontext(controller): controller.call_rcontext(None) -def test_call_rich(controller): - controller.call_rich(None) - - def test_call_richpanel(controller): controller.call_richpanel(None) - - -def test_call_ion(controller): - controller.call_ion(None) - - -def test_call_watermark(controller): - controller.call_watermark(None) - - -def test_call_cmdloc(controller): - controller.call_cmdloc(None) diff --git a/tests/openbb_terminal/test_terminal_controller.py b/tests/openbb_terminal/test_terminal_controller.py index 23bc9a5ff05..7abdbadde20 100644 --- a/tests/openbb_terminal/test_terminal_controller.py +++ b/tests/openbb_terminal/test_terminal_controller.py @@ -20,7 +20,6 @@ from openbb_terminal.core.session.current_user import ( def test_terminal_quick_exit(mocker): preferences = PreferencesModel( ENABLE_QUICK_EXIT=True, - USE_ION=False, USE_PROMPT_TOOLKIT=True, ) mock_current_user = copy_user(preferences=preferences) @@ -40,7 +39,6 @@ def test_terminal_quick_exit(mocker): def test_terminal_quit(mocker): preferences = PreferencesModel( ENABLE_QUICK_EXIT=True, - USE_ION=False, USE_PROMPT_TOOLKIT=True, ) mock_current_user = copy_user(preferences=preferences)