[Feature] Add An openbb-build Script To openbb-core Package (#6692)

* add an openbb-build script to openbb-core package

* import outside of top level

* use echo instead of print

---------

Co-authored-by: Igor Radovanovic <74266147+IgorWounds@users.noreply.github.com>
This commit is contained in:
Danglewood
2024-09-30 00:56:27 -07:00
committed by GitHub
parent 12f1199998
commit c697f55e18
3 changed files with 518 additions and 453 deletions

View File

@@ -0,0 +1,41 @@
"""Script to build the OpenBB platform static assets."""
# flake8: noqa: S603
# pylint: disable=import-outside-toplevel
import subprocess
import sys
def main():
"""Build the OpenBB platform static assets."""
try:
from openbb import build
build()
except (
ImportError,
ModuleNotFoundError,
AttributeError,
) as e:
subprocess.run(
["/bin/echo", "\nOpenBB build script not found, installing from PyPI...\n"],
check=True,
)
subprocess.run(
[sys.executable, "-m", "pip", "install", "openbb", "--no-deps"],
check=True,
)
try:
subprocess.run(
[sys.executable, "-c", "import openbb; openbb.build()"],
check=True,
)
except (subprocess.CalledProcessError, AttributeError):
raise RuntimeError(
"Failed to find the OpenBB build script. Install with `pip install openbb --no-deps`"
) from e
if __name__ == "__main__":
main()

925
openbb_platform/core/poetry.lock generated vendored

File diff suppressed because it is too large Load Diff

View File

@@ -22,9 +22,12 @@ requests = "^2.32.1"
importlib-metadata = "^6.8.0"
python-dotenv = "^1.0.0"
aiohttp = "^3.10.4"
ruff = ">=0.1.6" # Needed here to lint generated code
ruff = ">=0.4.10" # Needed here to lint generated code
pyjwt = "^2.8.0"
[tool.poetry.scripts]
openbb-build = "openbb_core.build:main"
[build-system]
requires = ["poetry-core"]
build-backend = "poetry.core.masonry.api"