[Feature] OpenBB V5: Initial openbb-core Refactor (#7482)

* initial refactor

* ruff does not dictate style

* unresolved imports in test action

* fix general linting

* resolve pandas imports for actions run

* httpx in test workflow

* pytest-asyncio in test workflow

* pandas.Index(...)

* max version for windows CI is 3.14

* remove temp refactor files that shouldn't have been committed:

* use ruff format instead of black

* formatting and typing

* tab space helper

* test fixtures..

* ty check
This commit is contained in:
Danglewood
2026-04-28 17:11:43 -07:00
committed by GitHub
parent a08d5d75d0
commit 7041362aa1
318 changed files with 17023 additions and 11503 deletions

View File

@@ -73,13 +73,10 @@ The first job, `code-linting`, runs on an Ubuntu machine and performs several li
- Checking out the code from the repository
- Setting up Python 3.10
- Installing a number of Python packages necessary for the linting tasks
- Running `bandit` to check for security vulnerabilities
- Running `black` to check the code formatting
- Running `codespell` to check the spelling of comments, strings, and variable names
- Running `ruff` to check the use of Python
- Running `pylint` to perform static analysis of the code
- Running `mypy` to check the type annotations
- Running `pydocstyle` to check the docstrings
- Running `black` to check the code formatting
- Running `ruff` to lint the code (replaces pylint, isort, flake8, and pydocstyle)
- Running `ty` to check the type annotations
The second job, `markdown-link-check`, runs on an Ubuntu machine and performs linting of the markdown files in the repository. It uses a Docker container `avtodev/markdown-lint` to perform the linting.

View File

@@ -59,16 +59,16 @@ jobs:
restore-keys: ${{ runner.os }}-linting-${{ hashFiles('**/poetry.lock') }}
- run: |
pip install openbb-devtools
pip install types-pytz types-requests types-termcolor types-tabulate types-PyYAML types-python-dateutil types-setuptools types-six
pip install ./openbb_platform/extensions/devtools
- name: Install openbb-core (so ty can resolve runtime deps)
run: pip install -e "./openbb_platform/core[pandas]" numpy
- run: codespell --ignore-words=.codespell.ignore --skip="$(tr '\n' ',' < .codespell.skip | sed 's/,$//')" --quiet-level=2
- run: |
# Run linters for openbb_platform | cli
if [ -n "${{ env.diff_files }}" ]; then
black --diff --check ${{ env.diff_files }}
mypy ${{ env.diff_files }} --ignore-missing-imports --scripts-are-modules --check-untyped-defs
pylint ${{ env.diff_files }}
ruff format --check ${{ env.diff_files }}
ruff check ${{ env.diff_files }}
ty check ${{ env.diff_files }}
else
echo "No Python files changed in openbb_platform | cli"
fi

87
.github/workflows/test-openbb-core.yml vendored Normal file
View File

@@ -0,0 +1,87 @@
name: 🧱 openbb-core
on:
pull_request:
branches:
- develop
- v5
paths:
- 'openbb_platform/core/**'
- 'openbb_platform/extensions/devtools/**'
- '.github/workflows/test-openbb-core.yml'
push:
branches:
- develop
- v5
- 'feature/**'
- 'hotfix/**'
- 'release/**'
paths:
- 'openbb_platform/core/**'
- 'openbb_platform/extensions/devtools/**'
- '.github/workflows/test-openbb-core.yml'
merge_group:
types: [checks_requested]
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
defaults:
run:
shell: bash
working-directory: openbb_platform/core
jobs:
test:
name: Test (${{ matrix.os }} / Python ${{ matrix.python_version }})
runs-on: ${{ matrix.os }}
permissions:
contents: read
strategy:
fail-fast: false
matrix:
include:
# Linux: full sweep across every supported Python.
- { os: ubuntu-latest, python_version: "3.10" }
- { os: ubuntu-latest, python_version: "3.11" }
- { os: ubuntu-latest, python_version: "3.12" }
- { os: ubuntu-latest, python_version: "3.13" }
- { os: ubuntu-latest, python_version: "3.14" }
- { os: ubuntu-latest, python_version: "3.15" }
# macOS and Windows: min and max supported.
- { os: macos-latest, python_version: "3.10" }
- { os: macos-latest, python_version: "3.15" }
- { os: windows-latest, python_version: "3.10" }
- { os: windows-latest, python_version: "3.14" }
steps:
- name: Checkout code
uses: actions/checkout@v6
with:
ref: ${{ github.event.pull_request.head.sha || github.sha }}
- name: Install Python ${{ matrix.python_version }}
uses: actions/setup-python@v6
with:
python-version: ${{ matrix.python_version }}
allow-prereleases: true
cache: "pip"
- name: Install openbb-core (with pandas extra) and test deps
run: |
python -m pip install --upgrade pip
pip install -e ".[pandas]"
pip install pytest pytest-cov pytest-asyncio httpx
- name: Run unit tests
run: |
pytest tests --cov=openbb_core --cov-report=term-missing --cov-report=xml -m "not integration"
- name: Upload coverage artifact
if: always()
uses: actions/upload-artifact@v4
with:
name: openbb-core-coverage-${{ matrix.os }}-py${{ matrix.python_version }}
path: openbb_platform/core/coverage.xml
if-no-files-found: ignore