mirror of
https://github.com/OpenBB-finance/OpenBB.git
synced 2026-10-27 20:42:26 +00:00
Custom args to package builder (#5282)
This commit is contained in:
@@ -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)
|
||||
|
||||
@@ -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:
|
||||
|
||||
Reference in New Issue
Block a user