[Feature] - Merge reference.json and extension_map.json, plus documentation generator fixes (#6268)

* Merge reference.json and extension_map.json

* feat: check all packages are built and installed

* rebuild

* fix

* small fix

* Update package_builder.py

* move core into info

* move extensions into info

* fix test

---------

Co-authored-by: Igor Radovanovic <74266147+IgorWounds@users.noreply.github.com>
This commit is contained in:
montezdesousa
2024-04-04 10:56:37 +01:00
committed by GitHub
parent 57deb8eeab
commit daa4520fea
12 changed files with 26862 additions and 26895 deletions

View File

@@ -6,12 +6,10 @@ from poetry.core.constraints.version import Version, VersionConstraint, parse_co
from poetry.core.pyproject.toml import PyProjectTOML
def load_ext_map(file: Path) -> Dict[str, Version]:
"""Load the extension map from extension_map.json."""
def create_ext_map(extensions: dict) -> Dict[str, Version]:
"""Create the extension map from extension."""
ext_map = {}
with open(file) as f:
ext_map_json = json.load(f)
for _, v in ext_map_json.items():
for _, v in extensions.items():
for value in v:
name, version = value.split("@")
ext_map[name] = Version.parse(version)
@@ -36,9 +34,9 @@ def load_req_ext(file: Path) -> Dict[str, VersionConstraint]:
def test_extension_map():
"""Ensure only required extensions are built and versions respect pyproject.toml"""
this_dir = Path(__file__).parent
ext_map = load_ext_map(
Path(this_dir, "..", "openbb", "assets", "extension_map.json")
)
with open(Path(this_dir, "..", "openbb", "assets", "reference.json")) as f:
reference = json.load(f)
ext_map = create_ext_map(reference.get("info", {}).get("extensions", {}))
req_ext = load_req_ext(Path(this_dir, "..", "pyproject.toml"))
for ext in req_ext: