diff --git a/openbb_sdk/openbb/__init__.py b/openbb_sdk/openbb/__init__.py index 0e24835e31f..fcb01a25b33 100644 --- a/openbb_sdk/openbb/__init__.py +++ b/openbb_sdk/openbb/__init__.py @@ -1,14 +1,15 @@ # flake8: noqa +from typing import List from openbb_core.app.static.app_factory import create_app as __create_app sdk = __create_app() obb = sdk -def _rebuild_python_interface() -> None: +def _rebuild_python_interface(*args, lint=True) -> None: """Rebuild the Python SDK.""" from openbb_core.app.static.package_builder import ( # pylint: disable=import-outside-toplevel PackageBuilder, ) - PackageBuilder.build() + PackageBuilder.build(modules=list(args), lint = lint) diff --git a/openbb_sdk/sdk/core/openbb_core/app/static/package_builder.py b/openbb_sdk/sdk/core/openbb_core/app/static/package_builder.py index 1018dd4346c..f557763e7ed 100644 --- a/openbb_sdk/sdk/core/openbb_core/app/static/package_builder.py +++ b/openbb_sdk/sdk/core/openbb_core/app/static/package_builder.py @@ -31,11 +31,11 @@ class PackageBuilder: """Build the extension package for the SDK.""" @classmethod - def build(cls, lint: bool = True) -> None: + def build(cls, modules:Optional[List[str]]=None, lint: bool = True) -> None: """Build the extensions for the SDK.""" print("\nBuilding extensions package...\n") cls.save_module_map() - cls.save_modules() + cls.save_modules(modules) cls.save_package() if lint: cls.run_linters() @@ -56,7 +56,7 @@ class PackageBuilder: ) @classmethod - def save_modules(cls): + def save_modules(cls, modules:Optional[List[str]] = None): """Save the modules.""" print("\nWriting modules...") route_map = PathHandler.build_route_map() @@ -68,6 +68,9 @@ class PackageBuilder: MAX_LEN = max([len(path) for path in path_list if path != "/"]) + if modules: + path_list = [path for path in path_list if path in modules] + for path in path_list: route = PathHandler.get_route(path=path, route_map=route_map) if route is None: