summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--cli/openbb_cli/assets/i18n/en.yml36
-rw-r--r--cli/openbb_cli/config/constants.py1
-rw-r--r--cli/openbb_cli/config/menu_text.py36
-rw-r--r--cli/openbb_cli/config/setup.py11
-rw-r--r--cli/openbb_cli/controllers/cli_controller.py20
-rw-r--r--cli/openbb_cli/controllers/settings_controller.py89
-rw-r--r--cli/poetry.lock24
-rw-r--r--cli/pyproject.toml1
8 files changed, 99 insertions, 119 deletions
diff --git a/cli/openbb_cli/assets/i18n/en.yml b/cli/openbb_cli/assets/i18n/en.yml
deleted file mode 100644
index 2e19ee4ce39..00000000000
--- a/cli/openbb_cli/assets/i18n/en.yml
+++ /dev/null
@@ -1,36 +0,0 @@
-en:
- intro: introduction on the OpenBB Platform CLI
- support: pre-populate a support ticket for our team to evaluate
- survey: fill in our 2-minute survey so we better understand how we can improve the CLI
- settings: enable and disable feature flags, preferences and settings
- _scripts_: Record and execute your own .openbb routine scripts
- record: start recording current session
- stop: stop session recording and convert to .openbb routine
- exe: execute .openbb routine scripts (use exe --example for an example)
- _configure_: Configure your own CLI
- _main_menu_: Main menu
- settings/_feature_flags_: Feature flags
- settings/_preferences_: Preferences
- settings/retryload: retry misspelled commands with load first
- settings/interactive: open dataframes in interactive window
- settings/cls: clear console after each command
- settings/color: use coloring features
- settings/promptkit: enable prompt toolkit (autocomplete and history)
- settings/thoughts: thoughts of the day
- settings/reporthtml: open report as HTML otherwise notebook
- settings/exithelp: automatically print help when quitting menu
- settings/rich: colorful rich CLI
- settings/richpanel: colorful rich CLI panel
- settings/watermark: watermark in figures
- settings/cmdloc: command location displayed in figures
- settings/overwrite: whether to overwrite Excel files if they already exists
- settings/version: whether to show the version in the bottom right corner
- settings/tbhint: displays usage hints in the bottom toolbar
- settings/console_style: apply a custom rich style to the CLI
- settings/flair: choose flair icon
- settings/timezone: pick timezone
- settings/n_rows: number of rows to show on non interactive tables
- settings/n_cols: number of columns to show on non interactive tables
- settings/obbject_msg: show obbject registry message after a new result is added
- settings/obbject_res: define the maximum number of obbjects allowed in the registry
- settings/obbject_display: define the maximum number of cached results to display on the help menu
diff --git a/cli/openbb_cli/config/constants.py b/cli/openbb_cli/config/constants.py
index 08aa50e107a..adac9bfd6f2 100644
--- a/cli/openbb_cli/config/constants.py
+++ b/cli/openbb_cli/config/constants.py
@@ -11,7 +11,6 @@ ASSETS_DIRECTORY = SRC_DIRECTORY / "assets"
STYLES_DIRECTORY = ASSETS_DIRECTORY / "styles"
ENV_FILE_SETTINGS = SETTINGS_DIRECTORY / ".cli.env"
HIST_FILE_PROMPT = SETTINGS_DIRECTORY / ".cli.his"
-I18N_FILE = ASSETS_DIRECTORY / "i18n"
DEFAULT_ROUTINES_URL = "https://openbb-cms.directus.app/items/Routines"
diff --git a/cli/openbb_cli/config/menu_text.py b/cli/openbb_cli/config/menu_text.py
index e4b4e1bf8c2..06c7023ef1f 100644
--- a/cli/openbb_cli/config/menu_text.py
+++ b/cli/openbb_cli/config/menu_text.py
@@ -4,7 +4,6 @@ __docformat__ = "numpy"
from typing import Dict, List
-import i18n
from openbb import obb
# https://rich.readthedocs.io/en/stable/appendix/colors.html#appendix-colors
@@ -92,10 +91,8 @@ class MenuText:
self, name: str, description: str, trim: bool = True
) -> str:
"""Truncate command description length if it is too long."""
- if not description:
- description = i18n.t(self.menu_path + name)
- if description == self.menu_path + name:
- description = ""
+ if not description or description == f"{self.menu_path}{name}":
+ description = ""
return (
description[: self.CMD_DESCRIPTION_LENGTH - 3] + "..."
if len(description) > self.CMD_DESCRIPTION_LENGTH and trim
@@ -122,23 +119,9 @@ class MenuText:
else:
self.menu_text += text
- def add_custom(self, name: str):
- """Append custom text (after translation)."""
- self.menu_text += f"{i18n.t(self.menu_path + name)}"
-
def add_info(self, text: str):
"""Append information text (after translation)."""
- self.menu_text += f"[info]{i18n.t(self.menu_path + text)}:[/info]\n"
-
- def add_param(self, name: str, value: str, col_align: int = 0):
- """Append parameter (after translation)."""
- parameter_translated = i18n.t(self.menu_path + name)
- space = (
- (col_align - len(parameter_translated)) * " "
- if col_align > len(parameter_translated)
- else ""
- )
- self.menu_text += f"[param]{parameter_translated}{space}:[/param] {value}\n"
+ self.menu_text += f"[info]{text}:[/info]\n"
def add_cmd(self, name: str, description: str = "", disable: bool = False):
"""Append command text (after translation)."""
@@ -174,10 +157,8 @@ class MenuText:
"""Append menu text (after translation)."""
spacing = (self.CMD_NAME_LENGTH - len(name) + self.SECTION_SPACING) * " "
- if not description:
- description = i18n.t(self.menu_path + name)
- if description == self.menu_path + name:
- description = ""
+ if not description or description == f"{self.menu_path}{name}":
+ description = ""
if len(description) > self.CMD_DESCRIPTION_LENGTH:
description = description[: self.CMD_DESCRIPTION_LENGTH - 3] + "..."
@@ -186,9 +167,12 @@ class MenuText:
tag = "unvl" if disable else "menu"
self.menu_text += f"[{tag}]> {menu}[/{tag}]\n"
- def add_setting(self, name: str, status: bool = True):
+ def add_setting(self, name: str, status: bool = True, description: str = ""):
"""Append menu text (after translation)."""
spacing = (self.CMD_NAME_LENGTH - len(name) + self.SECTION_SPACING) * " "
indentation = self.SECTION_SPACING * " "
color = "green" if status else "red"
- self.menu_text += f"[{color}]{indentation}{name}{spacing}{i18n.t(self.menu_path + name)}[/{color}]\n"
+
+ self.menu_text += (
+ f"[{color}]{indentation}{name}{spacing}{description}[/{color}]\n"
+ )
diff --git a/cli/openbb_cli/config/setup.py b/cli/openbb_cli/config/setup.py
index c507e5645a7..4d3eece690b 100644
--- a/cli/openbb_cli/config/setup.py
+++ b/cli/openbb_cli/config/setup.py
@@ -4,9 +4,7 @@ import copy
from pathlib import Path
from typing import TYPE_CHECKING, List, Optional, TypeVar
-import i18n
-
-from openbb_cli.config.constants import ENV_FILE_SETTINGS, I18N_FILE, SETTINGS_DIRECTORY
+from openbb_cli.config.constants import ENV_FILE_SETTINGS, SETTINGS_DIRECTORY
if TYPE_CHECKING:
from openbb_charting.core.openbb_figure import OpenBBFigure
@@ -69,13 +67,6 @@ def set_current_figure(fig: Optional[OpenBBFigureT] = None):
current_figure = fig
-def setup_i18n(i18n_path: Path = I18N_FILE, lang: str = "en"):
- """Select the CLI translation language."""
- i18n.load_path.append(i18n_path)
- i18n.set("locale", lang)
- i18n.set("filename_format", "{locale}.{format}")
-
-
def bootstrap():
"""Setup pre-launch configurations for the CLI."""
SETTINGS_DIRECTORY.mkdir(parents=True, exist_ok=True)
diff --git a/cli/openbb_cli/controllers/cli_controller.py b/cli/openbb_cli/controllers/cli_controller.py
index e44237ba82d..aec72410a84 100644
--- a/cli/openbb_cli/controllers/cli_controller.py
+++ b/cli/openbb_cli/controllers/cli_controller.py
@@ -220,13 +220,21 @@ class CLIController(BaseController):
def print_help(self):
"""Print help."""
mt = MenuText("")
- mt.add_info("_configure_")
- mt.add_menu("settings")
+ mt.add_info("Configure your own CLI")
+ mt.add_menu(
+ "settings",
+ description="enable and disable feature flags, preferences and settings",
+ )
mt.add_raw("\n")
- mt.add_info("_scripts_")
- mt.add_cmd("record")
- mt.add_cmd("stop")
- mt.add_cmd("exe")
+ mt.add_info("Record and execute your own .openbb routine scripts")
+ mt.add_cmd("record", description="start recording current session")
+ mt.add_cmd(
+ "stop", description="stop session recording and convert to .openbb routine"
+ )
+ mt.add_cmd(
+ "exe",
+ description="execute .openbb routine scripts (use exe --example for an example)",
+ )
mt.add_raw("\n")
mt.add_info("Retrieve data from different asset classes and providers")
diff --git a/cli/openbb_cli/controllers/settings_controller.py b/cli/openbb_cli/controllers/settings_controller.py
index 9f87d4cc677..f01742f6cb2 100644
--- a/cli/openbb_cli/controllers/settings_controller.py
+++ b/cli/openbb_cli/controllers/settings_controller.py
@@ -19,7 +19,6 @@ class SettingsController(BaseController):
"""Settings Controller class."""
CHOICES_COMMANDS: List[str] = [
- "retryload",
"tab",
"interactive",
"cls",
@@ -56,26 +55,76 @@ class SettingsController(BaseController):
settings = session.settings
mt = MenuText("settings/")
- mt.add_info("_feature_flags_")
- mt.add_setting("interactive", settings.USE_INTERACTIVE_DF)
- mt.add_setting("cls", settings.USE_CLEAR_AFTER_CMD)
- mt.add_setting("promptkit", settings.USE_PROMPT_TOOLKIT)
- mt.add_setting("exithelp", settings.ENABLE_EXIT_AUTO_HELP)
- mt.add_setting("rcontext", settings.REMEMBER_CONTEXTS)
- mt.add_setting("richpanel", settings.ENABLE_RICH_PANEL)
- mt.add_setting("tbhint", settings.TOOLBAR_HINT)
- mt.add_setting("overwrite", settings.FILE_OVERWRITE)
- mt.add_setting("version", settings.SHOW_VERSION)
- mt.add_setting("obbject_msg", settings.SHOW_MSG_OBBJECT_REGISTRY)
+ mt.add_info("Feature flags")
+ mt.add_setting(
+ "interactive",
+ settings.USE_INTERACTIVE_DF,
+ description="open dataframes in interactive window",
+ )
+ mt.add_setting(
+ "cls",
+ settings.USE_CLEAR_AFTER_CMD,
+ description="clear console after each command",
+ )
+ mt.add_setting(
+ "promptkit",
+ settings.USE_PROMPT_TOOLKIT,
+ description="enable prompt toolkit (autocomplete and history)",
+ )
+ mt.add_setting(
+ "exithelp",
+ settings.ENABLE_EXIT_AUTO_HELP,
+ description="automatically print help when quitting menu",
+ )
+ mt.add_setting(
+ "rcontext",
+ settings.REMEMBER_CONTEXTS,
+ description="remember contexts between menus",
+ )
+ mt.add_setting(
+ "richpanel",
+ settings.ENABLE_RICH_PANEL,
+ description="colorful rich CLI panel",
+ )
+ mt.add_setting(
+ "tbhint",
+ settings.TOOLBAR_HINT,
+ description="displays usage hints in the bottom toolbar",
+ )
+ mt.add_setting(
+ "overwrite",
+ settings.FILE_OVERWRITE,
+ description="whether to overwrite Excel files if they already exists",
+ )
+ mt.add_setting(
+ "version",
+ settings.SHOW_VERSION,
+ description="whether to show the version in the bottom right corner",
+ )
+ mt.add_setting(
+ "obbject_msg",
+ settings.SHOW_MSG_OBBJECT_REGISTRY,
+ description="show obbject registry message after a new result is added",
+ )
mt.add_raw("\n")
- mt.add_info("_preferences_")
- mt.add_cmd("console_style")
- mt.add_cmd("flair")
- mt.add_cmd("timezone")
- mt.add_cmd("n_rows")
- mt.add_cmd("n_cols")
- mt.add_cmd("obbject_res")
- mt.add_cmd("obbject_display")
+ mt.add_info("Preferences")
+ mt.add_cmd("console_style", description="apply a custom rich style to the CLI")
+ mt.add_cmd("flair", description="choose flair icon")
+ mt.add_cmd("timezone", description="pick timezone")
+ mt.add_cmd(
+ "n_rows", description="number of rows to show on non interactive tables"
+ )
+ mt.add_cmd(
+ "n_cols", description="number of columns to show on non interactive tables"
+ )
+ mt.add_cmd(
+ "obbject_res",
+ description="define the maximum number of obbjects allowed in the registry",
+ )
+ mt.add_cmd(
+ "obbject_display",
+ description="define the maximum number of cached results to display on the help menu",
+ )
session.console.print(text=mt.menu_text, menu="Settings")
diff --git a/cli/poetry.lock b/cli/poetry.lock
index 45b7fb75676..ee6b517c668 100644
--- a/cli/poetry.lock
+++ b/cli/poetry.lock
@@ -1710,7 +1710,6 @@ files = [
{file = "lxml-5.2.1-cp37-cp37m-musllinux_1_2_x86_64.whl", hash = "sha256:9e2addd2d1866fe112bc6f80117bcc6bc25191c5ed1bfbcf9f1386a884252ae8"},
{file = "lxml-5.2.1-cp37-cp37m-win32.whl", hash = "sha256:f51969bac61441fd31f028d7b3b45962f3ecebf691a510495e5d2cd8c8092dbd"},
{file = "lxml-5.2.1-cp37-cp37m-win_amd64.whl", hash = "sha256:b0b58fbfa1bf7367dde8a557994e3b1637294be6cf2169810375caf8571a085c"},
- {file = "lxml-5.2.1-cp38-cp38-macosx_10_9_universal2.whl", hash = "sha256:3e183c6e3298a2ed5af9d7a356ea823bccaab4ec2349dc9ed83999fd289d14d5"},
{file = "lxml-5.2.1-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:804f74efe22b6a227306dd890eecc4f8c59ff25ca35f1f14e7482bbce96ef10b"},
{file = "lxml-5.2.1-cp38-cp38-manylinux_2_12_i686.manylinux2010_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:08802f0c56ed150cc6885ae0788a321b73505d2263ee56dad84d200cab11c07a"},
{file = "lxml-5.2.1-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:0f8c09ed18ecb4ebf23e02b8e7a22a05d6411911e6fabef3a36e4f371f4f2585"},
@@ -1926,7 +1925,7 @@ files = [
{file = "msgpack-1.0.8-cp39-cp39-musllinux_1_1_x86_64.whl", hash = "sha256:5fbb160554e319f7b22ecf530a80a3ff496d38e8e07ae763b9e82fadfe96f273"},
{file = "msgpack-1.0.8-cp39-cp39-win32.whl", hash = "sha256:f9af38a89b6a5c04b7d18c492c8ccf2aee7048aff1ce8437c4683bb5a1df893d"},
{file = "msgpack-1.0.8-cp39-cp39-win_amd64.whl", hash = "sha256:ed59dd52075f8fc91da6053b12e8c89e37aa043f8986efd89e61fae69dc1b011"},
- {file = "msgpack-1.0.8-py3-none-any.whl", hash = "sha256:24f727df1e20b9876fa6e95f840a2a2651e34c0ad147676356f4bf5fbb0206ca"},
+ {file = "msgpack-1.0.8.tar.gz", hash = "sha256:95c02b0e27e706e48d0e5426d1710ca78e0f0628d6e89d5b5a5b91a5f12274f3"},
]
[[package]]
@@ -2721,8 +2720,8 @@ files = [
[package.dependencies]
numpy = [
- {version = ">=1.20.3", markers = "python_version < \"3.10\""},
{version = ">=1.21.0", markers = "python_version >= \"3.10\" and python_version < \"3.11\""},
+ {version = ">=1.20.3", markers = "python_version < \"3.10\""},
{version = ">=1.23.2", markers = "python_version >= \"3.11\""},
]
python-dateutil = ">=2.8.2"
@@ -3497,20 +3496,6 @@ files = [
cli = ["click (>=5.0)"]
[[package]]
-name = "python-i18n"
-version = "0.3.9"
-description = "Translation library for Python"
-optional = false
-python-versions = "*"
-files = [
- {file = "python-i18n-0.3.9.tar.gz", hash = "sha256:df97f3d2364bf3a7ebfbd6cbefe8e45483468e52a9e30b909c6078f5f471e4e8"},
- {file = "python_i18n-0.3.9-py3-none-any.whl", hash = "sha256:bda5b8d889ebd51973e22e53746417bd32783c9bd6780fd27cadbb733915651d"},
-]
-
-[package.extras]
-yaml = ["pyyaml (>=3.10)"]
-
-[[package]]
name = "python-jose"
version = "3.3.0"
description = "JOSE implementation in Python"
@@ -3634,6 +3619,7 @@ files = [
{file = "PyYAML-6.0.1-cp311-cp311-win_amd64.whl", hash = "sha256:bf07ee2fef7014951eeb99f56f39c9bb4af143d8aa3c21b1677805985307da34"},
{file = "PyYAML-6.0.1-cp312-cp312-macosx_10_9_x86_64.whl", hash = "sha256:855fb52b0dc35af121542a76b9a84f8d1cd886ea97c84703eaa6d88e37a2ad28"},
{file = "PyYAML-6.0.1-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:40df9b996c2b73138957fe23a16a4f0ba614f4c0efce1e9406a184b6d07fa3a9"},
+ {file = "PyYAML-6.0.1-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:a08c6f0fe150303c1c6b71ebcd7213c2858041a7e01975da3a99aed1e7a378ef"},
{file = "PyYAML-6.0.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:6c22bec3fbe2524cde73d7ada88f6566758a8f7227bfbf93a408a9d86bcc12a0"},
{file = "PyYAML-6.0.1-cp312-cp312-musllinux_1_1_x86_64.whl", hash = "sha256:8d4e9c88387b0f5c7d5f281e55304de64cf7f9c0021a3525bd3b1c542da3b0e4"},
{file = "PyYAML-6.0.1-cp312-cp312-win32.whl", hash = "sha256:d483d2cdf104e7c9fa60c544d92981f12ad66a457afae824d146093b8c294c54"},
@@ -4438,8 +4424,8 @@ files = [
[package.dependencies]
numpy = [
- {version = ">=1.18,<2", markers = "python_version != \"3.10\" or platform_system != \"Windows\" or platform_python_implementation == \"PyPy\""},
{version = ">=1.22.3,<2", markers = "python_version == \"3.10\" and platform_system == \"Windows\" and platform_python_implementation != \"PyPy\""},
+ {version = ">=1.18,<2", markers = "python_version != \"3.10\" or platform_system != \"Windows\" or platform_python_implementation == \"PyPy\""},
]
packaging = ">=21.3"
pandas = ">=1.0,<2.1.0 || >2.1.0"
@@ -5069,4 +5055,4 @@ testing = ["big-O", "jaraco.functools", "jaraco.itertools", "more-itertools", "p
[metadata]
lock-version = "2.0"
python-versions = "^3.8.1,<3.12"
-content-hash = "bf27c8f9b575f4443c195486a3d343775ae83bb1263642673a07872ac447af12"
+content-hash = "7dc546f808d5c75fc49d06a176cb053560ec0eaaf9da24e95716e8334672ae50"
diff --git a/cli/pyproject.toml b/cli/pyproject.toml
index 93d8ab34a93..1ff6afa4d21 100644
--- a/cli/pyproject.toml
+++ b/cli/pyproject.toml
@@ -24,7 +24,6 @@ openbb-charting = "^2.0.2"
prompt-toolkit = "^3.0.16"
rich = "^13"
python-dotenv = "^1.0.0"
-python-i18n = "^0.3.9"
[tool.poetry.group.dev.dependencies]
openbb-devtools = "^1.1.3"