openbb-cli 1.4.1__tar.gz → 1.4.2__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (44) hide show
  1. {openbb_cli-1.4.1 → openbb_cli-1.4.2}/PKG-INFO +3 -3
  2. {openbb_cli-1.4.1 → openbb_cli-1.4.2}/openbb_cli/controllers/base_controller.py +39 -5
  3. {openbb_cli-1.4.1 → openbb_cli-1.4.2}/openbb_cli/controllers/script_parser.py +17 -26
  4. {openbb_cli-1.4.1 → openbb_cli-1.4.2}/openbb_cli/session.py +7 -17
  5. {openbb_cli-1.4.1 → openbb_cli-1.4.2}/pyproject.toml +3 -3
  6. {openbb_cli-1.4.1 → openbb_cli-1.4.2}/README.md +0 -0
  7. {openbb_cli-1.4.1 → openbb_cli-1.4.2}/openbb_cli/__init__.py +0 -0
  8. {openbb_cli-1.4.1 → openbb_cli-1.4.2}/openbb_cli/argparse_translator/__init__.py +0 -0
  9. {openbb_cli-1.4.1 → openbb_cli-1.4.2}/openbb_cli/argparse_translator/argparse_argument.py +0 -0
  10. {openbb_cli-1.4.1 → openbb_cli-1.4.2}/openbb_cli/argparse_translator/argparse_class_processor.py +0 -0
  11. {openbb_cli-1.4.1 → openbb_cli-1.4.2}/openbb_cli/argparse_translator/argparse_translator.py +0 -0
  12. {openbb_cli-1.4.1 → openbb_cli-1.4.2}/openbb_cli/argparse_translator/obbject_registry.py +0 -0
  13. {openbb_cli-1.4.1 → openbb_cli-1.4.2}/openbb_cli/argparse_translator/reference_processor.py +0 -0
  14. {openbb_cli-1.4.1 → openbb_cli-1.4.2}/openbb_cli/argparse_translator/utils.py +0 -0
  15. {openbb_cli-1.4.1 → openbb_cli-1.4.2}/openbb_cli/assets/routines/routine_example.openbb +0 -0
  16. {openbb_cli-1.4.1 → openbb_cli-1.4.2}/openbb_cli/assets/styles/default/Consolas.ttf +0 -0
  17. {openbb_cli-1.4.1 → openbb_cli-1.4.2}/openbb_cli/assets/styles/default/dark.mpfstyle.json +0 -0
  18. {openbb_cli-1.4.1 → openbb_cli-1.4.2}/openbb_cli/assets/styles/default/dark.mplrc.json +0 -0
  19. {openbb_cli-1.4.1 → openbb_cli-1.4.2}/openbb_cli/assets/styles/default/dark.mplstyle +0 -0
  20. {openbb_cli-1.4.1 → openbb_cli-1.4.2}/openbb_cli/assets/styles/default/dark.pltstyle.json +0 -0
  21. {openbb_cli-1.4.1 → openbb_cli-1.4.2}/openbb_cli/assets/styles/default/dark.richstyle.json +0 -0
  22. {openbb_cli-1.4.1 → openbb_cli-1.4.2}/openbb_cli/assets/styles/default/light.mpfstyle.json +0 -0
  23. {openbb_cli-1.4.1 → openbb_cli-1.4.2}/openbb_cli/assets/styles/default/light.mplrc.json +0 -0
  24. {openbb_cli-1.4.1 → openbb_cli-1.4.2}/openbb_cli/assets/styles/default/light.mplstyle +0 -0
  25. {openbb_cli-1.4.1 → openbb_cli-1.4.2}/openbb_cli/assets/styles/default/light.pltstyle.json +0 -0
  26. {openbb_cli-1.4.1 → openbb_cli-1.4.2}/openbb_cli/assets/styles/default/light.richstyle.json +0 -0
  27. {openbb_cli-1.4.1 → openbb_cli-1.4.2}/openbb_cli/assets/styles/default/tables.pltstyle.json +0 -0
  28. {openbb_cli-1.4.1 → openbb_cli-1.4.2}/openbb_cli/assets/styles/user/openbb.richstyle.json +0 -0
  29. {openbb_cli-1.4.1 → openbb_cli-1.4.2}/openbb_cli/cli.py +0 -0
  30. {openbb_cli-1.4.1 → openbb_cli-1.4.2}/openbb_cli/config/__init__.py +0 -0
  31. {openbb_cli-1.4.1 → openbb_cli-1.4.2}/openbb_cli/config/completer.py +0 -0
  32. {openbb_cli-1.4.1 → openbb_cli-1.4.2}/openbb_cli/config/console.py +0 -0
  33. {openbb_cli-1.4.1 → openbb_cli-1.4.2}/openbb_cli/config/constants.py +0 -0
  34. {openbb_cli-1.4.1 → openbb_cli-1.4.2}/openbb_cli/config/menu_text.py +0 -0
  35. {openbb_cli-1.4.1 → openbb_cli-1.4.2}/openbb_cli/config/setup.py +0 -0
  36. {openbb_cli-1.4.1 → openbb_cli-1.4.2}/openbb_cli/config/style.py +0 -0
  37. {openbb_cli-1.4.1 → openbb_cli-1.4.2}/openbb_cli/controllers/base_platform_controller.py +0 -0
  38. {openbb_cli-1.4.1 → openbb_cli-1.4.2}/openbb_cli/controllers/choices.py +0 -0
  39. {openbb_cli-1.4.1 → openbb_cli-1.4.2}/openbb_cli/controllers/cli_controller.py +0 -0
  40. {openbb_cli-1.4.1 → openbb_cli-1.4.2}/openbb_cli/controllers/platform_controller_factory.py +0 -0
  41. {openbb_cli-1.4.1 → openbb_cli-1.4.2}/openbb_cli/controllers/settings_controller.py +0 -0
  42. {openbb_cli-1.4.1 → openbb_cli-1.4.2}/openbb_cli/controllers/utils.py +0 -0
  43. {openbb_cli-1.4.1 → openbb_cli-1.4.2}/openbb_cli/models/settings.py +0 -0
  44. {openbb_cli-1.4.1 → openbb_cli-1.4.2}/openbb_cli/utils/utils.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: openbb-cli
3
- Version: 1.4.1
3
+ Version: 1.4.2
4
4
  Summary: Investment Research for Everyone, Anywhere.
5
5
  License: AGPL-3.0-only
6
6
  Author: OpenBB
@@ -13,11 +13,11 @@ Classifier: Programming Language :: Python :: 3.11
13
13
  Classifier: Programming Language :: Python :: 3.12
14
14
  Classifier: Programming Language :: Python :: 3.13
15
15
  Classifier: Programming Language :: Python :: 3.14
16
- Requires-Dist: openbb[all] (>=4.7.1,<5.0.0)
16
+ Requires-Dist: openbb[all] (>=4.7.2,<5.0.0)
17
17
  Requires-Dist: openpyxl (>=3.1.5,<4.0.0)
18
18
  Requires-Dist: prompt-toolkit (>=3.0.50,<4.0.0)
19
19
  Requires-Dist: python-dotenv (>=1.0.1,<2.0.0)
20
- Requires-Dist: pywry (>=0.6.2,<0.7.0)
20
+ Requires-Dist: pywry (>=2.0.2)
21
21
  Requires-Dist: rich (>=14.0.0,<15.0.0)
22
22
  Project-URL: Documentation, https://docs.openbb.co/cli
23
23
  Project-URL: Homepage, https://openbb.co
@@ -201,7 +201,7 @@ class BaseController(metaclass=ABCMeta):
201
201
  # Single command fed, process
202
202
  else:
203
203
  try:
204
- (known_args, other_args) = self.parser.parse_known_args(
204
+ known_args, other_args = self.parser.parse_known_args(
205
205
  shlex.split(an_input)
206
206
  )
207
207
  except Exception as exc:
@@ -622,7 +622,7 @@ class BaseController(metaclass=ABCMeta):
622
622
  system_clear()
623
623
 
624
624
  try:
625
- (ns_parser, l_unknown_args) = parser.parse_known_args(other_args)
625
+ ns_parser, l_unknown_args = parser.parse_known_args(other_args)
626
626
  except SystemExit:
627
627
  # In case the command has required argument that isn't specified
628
628
  session.console.print("\n")
@@ -768,11 +768,45 @@ class BaseController(metaclass=ABCMeta):
768
768
  ),
769
769
  -1,
770
770
  )
771
- # Split comma-separated arguments, except for the argument at routine_args_index
771
+ # Collect indices whose values should NOT be comma-split because
772
+ # the provider may accept a comma-separated string (e.g. --symbol
773
+ # AAPL,MSFT). Handles --flag value, --flag=value, -f value, and
774
+ # multi-value flags (nargs="+" / nargs="*" / nargs=N).
775
+ no_split_indices: set[int] = set()
776
+ if 0 <= routine_args_index < len(other_args):
777
+ no_split_indices.add(routine_args_index)
778
+
779
+ for i, arg in enumerate(other_args):
780
+ if not arg.startswith("-"):
781
+ continue
782
+ # Handle --flag=value by extracting the flag portion.
783
+ flag_part = arg.split("=", 1)[0] if "=" in arg else arg
784
+ for action in parser._actions: # pylint: disable=protected-access
785
+ if flag_part in action.option_strings and action.nargs != 0:
786
+ if "=" in arg:
787
+ # Value is embedded in the same token.
788
+ no_split_indices.add(i)
789
+ elif action.nargs in ("+", "*") or (
790
+ isinstance(action.nargs, int) and action.nargs > 1
791
+ ):
792
+ # Multi-value flag: protect all consecutive
793
+ # non-flag tokens after the flag.
794
+ j = i + 1
795
+ while j < len(other_args) and not other_args[j].startswith(
796
+ "-"
797
+ ):
798
+ no_split_indices.add(j)
799
+ j += 1
800
+ # Single-value flag: protect the next token.
801
+ elif i + 1 < len(other_args):
802
+ no_split_indices.add(i + 1)
803
+ break
804
+
805
+ # Split comma-separated arguments only for positional / unflagged values.
772
806
  other_args = [
773
807
  part
774
808
  for index, arg in enumerate(other_args)
775
- for part in (arg.split(",") if index != routine_args_index else [arg])
809
+ for part in ([arg] if index in no_split_indices else arg.split(","))
776
810
  ]
777
811
 
778
812
  # Check if the action has optional choices, if yes, remove them
@@ -780,7 +814,7 @@ class BaseController(metaclass=ABCMeta):
780
814
  if getattr(action, "optional_choices", None):
781
815
  action.choices = None
782
816
 
783
- (ns_parser, l_unknown_args) = parser.parse_known_args(other_args)
817
+ ns_parser, l_unknown_args = parser.parse_known_args(other_args)
784
818
 
785
819
  if export_allowed in [
786
820
  "raw_data_only",
@@ -9,7 +9,7 @@ from openbb_cli.session import Session
9
9
 
10
10
  session = Session()
11
11
 
12
- # pylint: disable=too-many-statements,eval-used,consider-iterating-dictionary
12
+ # pylint: disable=too-many-statements,consider-iterating-dictionary
13
13
  # pylint: disable=too-many-branches,too-many-return-statements
14
14
 
15
15
  # Necessary for OpenBB keywords
@@ -248,13 +248,11 @@ def parse_openbb_script( # noqa: PLR0911,PLR0912
248
248
  # in python will only take the first '2'
249
249
  if VAR_SLICE == "0":
250
250
  if VAR_NAME in ROUTINE_VARS:
251
- values = eval( # noqa: S307
252
- f'ROUTINE_VARS["{VAR_NAME}"]'
253
- )
251
+ values = ROUTINE_VARS[VAR_NAME]
254
252
  if isinstance(values, list):
255
253
  templine = templine.replace(
256
254
  match[0],
257
- eval(f"values[{VAR_SLICE}]"), # noqa: S307
255
+ values[int(VAR_SLICE)],
258
256
  )
259
257
  else:
260
258
  templine = templine.replace(match[0], values)
@@ -266,9 +264,7 @@ def parse_openbb_script( # noqa: PLR0911,PLR0912
266
264
 
267
265
  # Only enters here when any other index from 0 is used
268
266
  elif VAR_NAME in ROUTINE_VARS:
269
- variable = eval( # noqa: S307
270
- f'ROUTINE_VARS["{VAR_NAME}"]'
271
- )
267
+ variable = ROUTINE_VARS[VAR_NAME]
272
268
  length_variable = (
273
269
  len(variable) if isinstance(variable, list) else 1
274
270
  )
@@ -300,23 +296,20 @@ def parse_openbb_script( # noqa: PLR0911,PLR0912
300
296
  or VAR_SLICE.split(":")[1].isdigit()
301
297
  )
302
298
  ):
303
- slicing_tuple = "slice("
304
- slicing_tuple += (
305
- VAR_SLICE.split(":")[0]
306
- if VAR_SLICE.split(":")[0].isdigit()
307
- else "None"
299
+ parts = VAR_SLICE.split(":")
300
+ start = (
301
+ int(parts[0])
302
+ if parts[0] and parts[0].lstrip("-").isdigit()
303
+ else None
308
304
  )
309
- slicing_tuple += ","
310
- slicing_tuple += (
311
- VAR_SLICE.split(":")[1]
312
- if VAR_SLICE.split(":")[1].isdigit()
313
- else "None"
314
- )
315
- slicing_tuple += ")"
316
-
317
- vars_to_loop = eval( # noqa: S307
318
- f'ROUTINE_VARS["{VAR_NAME}"][{slicing_tuple}]'
305
+ stop = (
306
+ int(parts[1])
307
+ if len(parts) > 1
308
+ and parts[1]
309
+ and parts[1].lstrip("-").isdigit()
310
+ else None
319
311
  )
312
+ vars_to_loop = ROUTINE_VARS[VAR_NAME][slice(start, stop)]
320
313
 
321
314
  # Check whether the slicing was successful or not
322
315
  if vars_to_loop:
@@ -352,9 +345,7 @@ def parse_openbb_script( # noqa: PLR0911,PLR0912
352
345
  )
353
346
 
354
347
  if VAR_NAME in ROUTINE_VARS:
355
- value = eval( # noqa: S307
356
- f'ROUTINE_VARS["{VAR_NAME}"]'
357
- )
348
+ value = ROUTINE_VARS[VAR_NAME]
358
349
 
359
350
  # If the value is a list, we want to replace it with the whole list
360
351
  if isinstance(value, list):
@@ -4,7 +4,7 @@ import sys
4
4
  from pathlib import Path
5
5
 
6
6
  from openbb import obb
7
- from openbb_charting.core.backend import create_backend, get_backend
7
+ from openbb_charting.core.backend import Backend
8
8
  from openbb_core.app.model.abstract.singleton import SingletonMeta
9
9
  from openbb_core.app.model.charts.charting_settings import ChartingSettings
10
10
  from openbb_core.app.model.user_settings import UserSettings as User
@@ -18,21 +18,6 @@ from openbb_cli.config.style import Style
18
18
  from openbb_cli.models.settings import Settings
19
19
 
20
20
 
21
- def _get_backend():
22
- """Get the Platform charting backend."""
23
- try:
24
- return get_backend()
25
- except ValueError:
26
- # backend might not be created yet
27
- charting_settings = ChartingSettings(
28
- system_settings=obb.system, # type: ignore
29
- user_settings=obb.user, # type: ignore
30
- )
31
- create_backend(charting_settings)
32
- get_backend().start(debug=charting_settings.debug_mode) # type: ignore
33
- return get_backend()
34
-
35
-
36
21
  class Session(metaclass=SingletonMeta):
37
22
  """Session class."""
38
23
 
@@ -51,7 +36,12 @@ class Session(metaclass=SingletonMeta):
51
36
  self._prompt_session = self._get_prompt_session()
52
37
  self._obbject_registry = Registry()
53
38
 
54
- self._backend = _get_backend()
39
+ self._backend = Backend(
40
+ ChartingSettings(
41
+ system_settings=obb.system, # type: ignore
42
+ user_settings=obb.user, # type: ignore
43
+ )
44
+ )
55
45
 
56
46
  @property
57
47
  def user(self) -> User:
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "openbb-cli"
3
- version = "1.4.1"
3
+ version = "1.4.2"
4
4
  description = "Investment Research for Everyone, Anywhere."
5
5
  authors = ["OpenBB <hello@openbb.co>"]
6
6
  packages = [{ include = "openbb_cli" }]
@@ -17,14 +17,14 @@ openbb = 'openbb_cli.cli:main'
17
17
  python = ">=3.10,<4"
18
18
 
19
19
  # OpenBB dependencies
20
- openbb = { version = "^4.7.1", extras = ["all"] }
20
+ openbb = { version = "^4.7.2", extras = ["all"] }
21
21
 
22
22
  # CLI dependencies
23
23
  prompt-toolkit = "^3.0.50"
24
24
  rich = "^14.0.0"
25
25
  python-dotenv = "^1.0.1"
26
26
  openpyxl = "^3.1.5"
27
- pywry = "^0.6.2"
27
+ pywry = ">=2.0.2"
28
28
 
29
29
  [build-system]
30
30
  requires = ["poetry-core>=1.0.0"]
File without changes
File without changes