mirror of
https://github.com/OpenBB-finance/OpenBB.git
synced 2026-10-28 13:01:38 +00:00
Custom args to package builder (#5282)
This commit is contained in:
@@ -1,14 +1,15 @@
|
|||||||
# flake8: noqa
|
# flake8: noqa
|
||||||
|
from typing import List
|
||||||
from openbb_core.app.static.app_factory import create_app as __create_app
|
from openbb_core.app.static.app_factory import create_app as __create_app
|
||||||
|
|
||||||
sdk = __create_app()
|
sdk = __create_app()
|
||||||
obb = sdk
|
obb = sdk
|
||||||
|
|
||||||
|
|
||||||
def _rebuild_python_interface() -> None:
|
def _rebuild_python_interface(*args, lint=True) -> None:
|
||||||
"""Rebuild the Python SDK."""
|
"""Rebuild the Python SDK."""
|
||||||
from openbb_core.app.static.package_builder import ( # pylint: disable=import-outside-toplevel
|
from openbb_core.app.static.package_builder import ( # pylint: disable=import-outside-toplevel
|
||||||
PackageBuilder,
|
PackageBuilder,
|
||||||
)
|
)
|
||||||
|
|
||||||
PackageBuilder.build()
|
PackageBuilder.build(modules=list(args), lint = lint)
|
||||||
|
|||||||
@@ -31,11 +31,11 @@ class PackageBuilder:
|
|||||||
"""Build the extension package for the SDK."""
|
"""Build the extension package for the SDK."""
|
||||||
|
|
||||||
@classmethod
|
@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."""
|
"""Build the extensions for the SDK."""
|
||||||
print("\nBuilding extensions package...\n")
|
print("\nBuilding extensions package...\n")
|
||||||
cls.save_module_map()
|
cls.save_module_map()
|
||||||
cls.save_modules()
|
cls.save_modules(modules)
|
||||||
cls.save_package()
|
cls.save_package()
|
||||||
if lint:
|
if lint:
|
||||||
cls.run_linters()
|
cls.run_linters()
|
||||||
@@ -56,7 +56,7 @@ class PackageBuilder:
|
|||||||
)
|
)
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def save_modules(cls):
|
def save_modules(cls, modules:Optional[List[str]] = None):
|
||||||
"""Save the modules."""
|
"""Save the modules."""
|
||||||
print("\nWriting modules...")
|
print("\nWriting modules...")
|
||||||
route_map = PathHandler.build_route_map()
|
route_map = PathHandler.build_route_map()
|
||||||
@@ -68,6 +68,9 @@ class PackageBuilder:
|
|||||||
|
|
||||||
MAX_LEN = max([len(path) for path in path_list if path != "/"])
|
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:
|
for path in path_list:
|
||||||
route = PathHandler.get_route(path=path, route_map=route_map)
|
route = PathHandler.get_route(path=path, route_map=route_map)
|
||||||
if route is None:
|
if route is None:
|
||||||
|
|||||||
Reference in New Issue
Block a user