mirror of
https://github.com/OpenBB-finance/OpenBB.git
synced 2026-11-27 03:33:24 +00:00
Feature/charting obbject (#5938)
* fix circular import issues on the obbject extension framework * settings available on the obbject * extension init * charting assets and code * introduce to_chart functionality * removes the to_chart method from obbject in detriment of the one from the obbject extension * Update openbb_platform/obbject_extensions/charting/charting/__init__.py Co-authored-by: montezdesousa <79287829+montezdesousa@users.noreply.github.com> * fix on the show method * adding the example to the to_chart docstring * copying the exsting README from charting extension - needs to be revamped * moving to openbb_charting instead * update the pyproject.toml file * pydocstyle * versions * better docstrings * making accessors public * removing unnecessary credentials variable cc @montezdesousa * removing access to extra/metadata and use designated private attrs instead * Fixes linting for the logging service (#5992) * lints * typing.Type instead * deprecating ChartingService to use the new extension instead - adding function discovery capabilities using it * tests for the obbject charting extension * removing charting service from command runner * filter functions not implemented in the module * remove charting service tests * removing charting service on the tests for int tests * charting integration tests * removing charting service file * removing old charting extension code * revamp builder * fix obbject tests * fix command_runner tests * removing openbb_figure_table * better website docs * reviewed readme * unsetting api key for posthog (pywry) windows * added debug_mode to the system settings * removing api key * update nightly script * fix tests * black * black * Revert "black" This reverts commit21d76ad689. * Revert "black" This reverts commit0904653fd7. * black for henrique * returning a list instead * better docstrings * removing unnecessary indicators docstring * typo * black * intentional access to protected member * changes to publish script * filtering deleted files * black * adding render argument * fixing the df_to_basemodel function: it should include the index in the columns either if flagged or if the index is named * adding the hability to add you own data to to_chart method * tests * black * disable protected access * accept kwargs to eg. save image * adjustment cc Igor * add if statement for protection * remove unused return typing * fix technical charting views * better error message cc @IgorWounds * better structure and fix test * Revert "better structure and fix test" This reverts commit612ea6117c. * Revert "better error message cc @IgorWounds" This reverts commit3d7ee53878. --------- Co-authored-by: montezdesousa <79287829+montezdesousa@users.noreply.github.com> Co-authored-by: Danglewood <85772166+deeleeramone@users.noreply.github.com> Co-authored-by: Igor Radovanovic <74266147+IgorWounds@users.noreply.github.com> Co-authored-by: James Maslek <jmaslek11@gmail.com>
This commit is contained in:
@@ -2,10 +2,11 @@
|
||||
|
||||
import argparse
|
||||
import os
|
||||
from pathlib import Path
|
||||
from typing import Dict, List, Literal, Type, get_type_hints
|
||||
|
||||
import requests
|
||||
from openbb_core.app.charting_service import ChartingService
|
||||
from openbb_charting import Charting
|
||||
from openbb_core.app.provider_interface import ProviderInterface
|
||||
from openbb_core.app.router import CommandMap
|
||||
|
||||
@@ -160,25 +161,21 @@ def write_commands_integration_tests(
|
||||
|
||||
def write_charting_extension_integration_tests():
|
||||
"""Write the charting extension integration tests."""
|
||||
functions = ChartingService.get_implemented_charting_functions()
|
||||
import openbb_charting # pylint: disable=import-outside-toplevel
|
||||
|
||||
# we assume test file exists
|
||||
path = os.path.join(
|
||||
"openbb_platform",
|
||||
"extensions",
|
||||
"charting",
|
||||
"integration",
|
||||
"test_charting_api.py",
|
||||
)
|
||||
functions = Charting.functions()
|
||||
|
||||
charting_ext_path = Path(openbb_charting.__file__).parent.parent
|
||||
test_file = charting_ext_path / "integration" / "test_charting_api.py"
|
||||
|
||||
for function in functions:
|
||||
route = "/" + function.replace("_", "/")
|
||||
if not test_exists(route=function, path=path):
|
||||
if not test_exists(route=function, path=test_file):
|
||||
write_test_w_template(
|
||||
http_method="post",
|
||||
params_list=[{"chart": True}],
|
||||
route=route,
|
||||
path=path,
|
||||
path=test_file,
|
||||
chart=True,
|
||||
)
|
||||
|
||||
|
||||
@@ -14,7 +14,7 @@ from typing import (
|
||||
get_type_hints,
|
||||
)
|
||||
|
||||
from openbb_core.app.charting_service import ChartingService
|
||||
from openbb_charting import Charting
|
||||
from openbb_core.app.provider_interface import ProviderInterface
|
||||
from openbb_core.app.router import CommandMap
|
||||
from pydantic.fields import FieldInfo
|
||||
@@ -44,6 +44,9 @@ def find_extensions(filter_chart: Optional[bool] = True):
|
||||
if filter_chart:
|
||||
filter_ext.append("charting")
|
||||
extensions = [x for x in Path("openbb_platform/extensions").iterdir() if x.is_dir()]
|
||||
extensions.extend(
|
||||
[x for x in Path("openbb_platform/obbject_extensions").iterdir() if x.is_dir()]
|
||||
)
|
||||
extensions = [x for x in extensions if x.name not in filter_ext]
|
||||
return extensions
|
||||
|
||||
@@ -279,7 +282,7 @@ def write_charting_extension_integration_tests():
|
||||
"""Write charting extension integration tests."""
|
||||
import openbb_charting # pylint: disable=import-outside-toplevel
|
||||
|
||||
functions = ChartingService.get_implemented_charting_functions()
|
||||
functions = Charting.functions()
|
||||
|
||||
charting_ext_path = Path(openbb_charting.__file__).parent.parent
|
||||
test_file = charting_ext_path / "integration" / "test_charting_python.py"
|
||||
@@ -306,15 +309,15 @@ if __name__ == "__main__":
|
||||
parser.add_argument(
|
||||
"--charting",
|
||||
dest="charting",
|
||||
default=True,
|
||||
action="store_false",
|
||||
default=False,
|
||||
action="store_true",
|
||||
help="Generate charting extension integration tests",
|
||||
)
|
||||
parser.add_argument(
|
||||
"--commands",
|
||||
dest="commands",
|
||||
default=True,
|
||||
action="store_false",
|
||||
default=False,
|
||||
action="store_true",
|
||||
help="Generate commands integration tests",
|
||||
)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user