Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature] Hotfix develop main sync #6200

Merged
merged 14 commits into from
Mar 13, 2024
Merged
107 changes: 0 additions & 107 deletions .github/workflows/manual-unit-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -147,110 +147,3 @@ jobs:
run: |
source $VENV
pytest tests/ --optimization --autodoc -n auto --timeout=30

tests-conda:
name: Anaconda Python Tests - (${{ matrix.python-version }}, ${{ matrix.os }})
runs-on: ${{ matrix.os }}-latest
strategy:
fail-fast: false
matrix:
os: ["ubuntu", "windows", "macos"]
python-version: ["3.9"]
dependencies: [""]
include:
- os: ubuntu
python: 3.9
- os: windows
python: 3.9
env:
OS: ${{ matrix.os }}
PYTHON: ${{ matrix.python }}
PYTHONNOUSERSITE: 1

steps:
- name: Set git to use LF
if: runner.os == 'Windows'
run: |
git config --global core.autocrlf false
git config --global core.eol lf

- name: Setup sudo apt installs for ubuntu-latest
if: runner.os == 'Linux'
run: |
sudo apt-get update
sudo apt-get install -y \
libgtk-3-dev \
libwebkit2gtk-4.0-dev

- name: Checkout
uses: actions/checkout@v3
with:
# Need to fetch more than the last commit so that setuptools-scm can
# create the correct version string. If the number of commits since
# the last release is greater than this, the version still be wrong.
# Increase if necessary.
fetch-depth: 100
# The GitHub token is preserved by default but this job doesn't need
# to be able to push to GitHub.
persist-credentials: false

- name: Setup caching for conda packages
uses: actions/cache@v3
with:
path: ~/conda_pkgs_dir
key: conda-${{ runner.os }}-v1-${{ matrix.python }}-${{ hashFiles('build/conda/conda-3-9-env-full.yaml') }}

- name: Setup Miniconda
uses: conda-incubator/setup-miniconda@v2
with:
python-version: ${{ matrix.python }}
miniconda-version: "latest"
auto-update-conda: true
channels: conda-forge,defaults
show-channel-urls: true
channel-priority: flexible
environment-file: build/conda/conda-3-9-env.yaml
activate-environment: testing
# Needed for caching
use-only-tar-bz2: true

- name: Update Temp permissions on windows
if: runner.os == 'Windows'
shell: cmd /C CALL {0}
run: >-
c:\windows\system32\icacls C:\Users\runneradmin\AppData\Local\Temp /grant "everyone":F /t

- name: Get pip cache dir
shell: bash -l {0}
id: pip-cache
run: |
echo "dir=$(pip cache dir)" >> $GITHUB_OUTPUT

- name: pip cache
uses: actions/cache@v3
with:
path: ${{ steps.pip-cache.outputs.dir }}
key: ${{ runner.os }}-v1-3-9-pip-${{ hashFiles('requirements-full.txt') }}
restore-keys: |
${{ runner.os }}-v1-pip-

- name: Install dependencies (Bash)
shell: bash -l {0}
run: |
pip install --requirement requirements-full.txt
pip uninstall Brotli -y

- name: List installed packages (Bash)
shell: bash -l {0}
run: |
conda list
pip list

- name: Run tests (Bash)
env:
MPLBACKEND: Agg
shell: bash -l {0}
run: pytest tests/ -m "not linux" --optimization -n auto --timeout=30
- name: Start Terminal and exit
shell: bash -l {0}
run: python terminal.py
108 changes: 1 addition & 107 deletions .github/workflows/unit-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -253,110 +253,4 @@ jobs:
MPLBACKEND: Agg
run: |
source $VENV
pytest tests/ --optimization --autodoc -n auto --timeout=30

tests-conda:
name: Anaconda Python Tests - (${{ matrix.python-version }}, ${{ matrix.os }})
runs-on: ${{ matrix.os }}-latest
if: github.event_name == 'push' || github.event.pull_request.merged == true
strategy:
fail-fast: false
matrix:
os: ["ubuntu", "macos"]
python-version: ["3.9"]
dependencies: [""]
include:
- os: ubuntu
python: 3.9
env:
OS: ${{ matrix.os }}
PYTHON: ${{ matrix.python }}
PYTHONNOUSERSITE: 1

steps:
- name: Set git to use LF
if: runner.os == 'Windows'
run: |
git config --global core.autocrlf false
git config --global core.eol lf

- name: Setup sudo apt installs for ubuntu-latest
if: runner.os == 'Linux'
run: |
sudo apt-get update
sudo apt-get install -y \
libgtk-3-dev \
libwebkit2gtk-4.0-dev

- name: Checkout
uses: actions/checkout@v3
with:
# Need to fetch more than the last commit so that setuptools-scm can
# create the correct version string. If the number of commits since
# the last release is greater than this, the version still be wrong.
# Increase if necessary.
fetch-depth: 100
# The GitHub token is preserved by default but this job doesn't need
# to be able to push to GitHub.
persist-credentials: false

- name: Setup caching for conda packages
uses: actions/cache@v3
with:
path: ~/conda_pkgs_dir
key: conda-${{ runner.os }}-v1-${{ matrix.python }}-${{ hashFiles('build/conda/conda-3-9-env-full.yaml') }}

- name: Setup Miniconda
uses: conda-incubator/setup-miniconda@v2
with:
python-version: ${{ matrix.python }}
miniconda-version: "latest"
auto-update-conda: true
channels: conda-forge,defaults
show-channel-urls: true
channel-priority: flexible
environment-file: build/conda/conda-3-9-env.yaml
activate-environment: testing
# Needed for caching
use-only-tar-bz2: true

- name: Update Temp permissions on windows
if: runner.os == 'Windows'
shell: cmd /C CALL {0}
run: >-
c:\windows\system32\icacls C:\Users\runneradmin\AppData\Local\Temp /grant "everyone":F /t

- name: Get pip cache dir
shell: bash -l {0}
id: pip-cache
run: |
echo "dir=$(pip cache dir)" >> $GITHUB_OUTPUT

- name: pip cache
uses: actions/cache@v3
with:
path: ${{ steps.pip-cache.outputs.dir }}
key: ${{ runner.os }}-v1-3-9-pip-${{ hashFiles('requirements-full.txt') }}
restore-keys: |
${{ runner.os }}-v1-pip-

- name: Install dependencies (Bash)
shell: bash -l {0}
run: |
pip install --requirement requirements-full.txt
pip uninstall Brotli -y

- name: List installed packages (Bash)
shell: bash -l {0}
run: |
conda list
pip list

- name: Run tests (Bash)
env:
MPLBACKEND: Agg
shell: bash -l {0}
run: pytest tests/ -m "not linux" --optimization -n auto --timeout=30
- name: Start Terminal and exit
shell: bash -l {0}
run: python terminal.py
pytest tests/ --optimization --autodoc -n auto --timeout=30
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ repos:
- id: check-merge-conflict
- id: detect-private-key
- repo: https://github.com/psf/black
rev: 23.1.0
rev: 24.1.0
hooks:
- id: black
- repo: https://github.com/charliermarsh/ruff-pre-commit
Expand Down
20 changes: 19 additions & 1 deletion openbb_platform/core/openbb_core/app/extension_loader.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

from enum import Enum
from functools import lru_cache
from typing import TYPE_CHECKING, Any, Dict, Optional
from typing import TYPE_CHECKING, Any, Dict, List, Optional

from importlib_metadata import EntryPoint, EntryPoints, entry_points

Expand All @@ -21,6 +21,15 @@ class OpenBBGroups(Enum):
provider = "openbb_provider_extension"
obbject = "openbb_obbject_extension"

@staticmethod
def groups() -> List[str]:
"""Return the OpenBBGroups."""
return [
OpenBBGroups.core.value,
OpenBBGroups.provider.value,
OpenBBGroups.obbject.value,
]


class ExtensionLoader(metaclass=SingletonMeta):
"""Extension loader class."""
Expand Down Expand Up @@ -57,6 +66,15 @@ def provider_entry_points(self) -> EntryPoints:
"""Return the provider entry points."""
return self._provider_entry_points

@property
def entry_points(self) -> List[EntryPoints]:
"""Return the entry points."""
return [
self._core_entry_points,
self._provider_entry_points,
self._obbject_entry_points,
]

@staticmethod
def _get_entry_point(
entry_points_: EntryPoints, ext_name: str
Expand Down
20 changes: 6 additions & 14 deletions openbb_platform/core/openbb_core/app/static/package_builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,11 +92,11 @@ def auto_build(self) -> None:
self.directory / "assets" / "extension_map.json"
)
if add:
a = ", ".join(add)
a = ", ".join(sorted(add))
print(f"Extensions to add: {a}") # noqa: T201

if remove:
r = ", ".join(remove)
r = ", ".join(sorted(remove))
print(f"Extensions to remove: {r}") # noqa: T201

if add or remove:
Expand Down Expand Up @@ -132,18 +132,10 @@ def _clean(self, modules: Optional[Union[str, List[str]]] = None) -> None:
def _get_extension_map(self) -> Dict[str, List[str]]:
"""Get map of extensions available at build time."""
el = ExtensionLoader()
og = OpenBBGroups.groups()
ext_map: Dict[str, List[str]] = {}

groups = [
OpenBBGroups.core.value,
OpenBBGroups.provider.value,
]
entry_points_ = [
el.core_entry_points,
el.provider_entry_points,
]

for group, entry_point in zip(groups, entry_points_):
for group, entry_point in zip(og, el.entry_points):
ext_map[group] = [
f"{e.name}@{getattr(e.dist, 'version', '')}" for e in entry_point
]
Expand Down Expand Up @@ -252,7 +244,8 @@ def _diff(path: Path) -> Tuple[Set[str], Set[str]]:

add: Set[str] = set()
remove: Set[str] = set()
groups = ("openbb_core_extension", "openbb_provider_extension")
groups = OpenBBGroups.groups()

for g in groups:
built = set(ext_map.get(g, {}))
installed = set(
Expand Down Expand Up @@ -556,7 +549,6 @@ def format_params(
path: str, parameter_map: Dict[str, Parameter]
) -> OrderedDict[str, Parameter]:
"""Format the params."""

parameter_map.pop("cc", None)
# we need to add the chart parameter here bc of the docstring generation
if CHARTING_INSTALLED and path.replace("/", "_")[1:] in Charting.functions():
Expand Down
Loading
Loading