Skip to content

Commit

Permalink
[Feature] Add An openbb-build Script To openbb-core Package (#6692)
Browse files Browse the repository at this point in the history
* add an openbb-build script to openbb-core package

* import outside of top level

* use echo instead of print

---------

Co-authored-by: Igor Radovanovic <[email protected]>
  • Loading branch information
deeleeramone and IgorWounds authored Sep 30, 2024
1 parent 12f1199 commit c697f55
Show file tree
Hide file tree
Showing 3 changed files with 518 additions and 453 deletions.
41 changes: 41 additions & 0 deletions openbb_platform/core/openbb_core/build.py
Original file line number Diff line number Diff line change
@@ -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()
Loading

0 comments on commit c697f55

Please sign in to comment.