Skip to content

Commit

Permalink
Custom args to package builder (#5282)
Browse files Browse the repository at this point in the history
  • Loading branch information
jmaslek authored Aug 3, 2023
1 parent ed07f6a commit ce5b93a
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
5 changes: 3 additions & 2 deletions openbb_sdk/openbb/__init__.py
Original file line number Diff line number Diff line change
@@ -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)
9 changes: 6 additions & 3 deletions openbb_sdk/sdk/core/openbb_core/app/static/package_builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand All @@ -56,7 +56,7 @@ def save_module_map(cls):
)

@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()
Expand All @@ -68,6 +68,9 @@ def save_modules(cls):

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:
Expand Down

0 comments on commit ce5b93a

Please sign in to comment.