mirror of
https://github.com/OpenBB-finance/OpenBB.git
synced 2026-11-09 02:42:36 +00:00
[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:
41
openbb_platform/core/openbb_core/build.py
Normal file
41
openbb_platform/core/openbb_core/build.py
Normal 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
925
openbb_platform/core/poetry.lock
generated
vendored
File diff suppressed because it is too large
Load Diff
5
openbb_platform/core/pyproject.toml
vendored
5
openbb_platform/core/pyproject.toml
vendored
@@ -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"
|
||||
|
||||
Reference in New Issue
Block a user