Files
OpenBB/.github/workflows/test-unit-openbb-us-eia.yml
dlee-bq e99af5a2a0 Drop Python 3.10 support
Python 3.10 reached end of life on 2026-10-01, and the patched releases of
Pillow (13.0.0) and filelock (>=4.2.1) require Python >=3.11, so the 3.10
resolution fork kept vulnerable versions in every lockfile.

- requires-python = ">=3.11,<4" in all pyproject.toml files, the
  cookiecutter template, and the CLI codegen project template
- CI: drop the ubuntu 3.10 matrix rows, move the macOS/Windows minimum
  rows and the lint jobs to 3.11, drop 3.10 from the nox sessions
- READMEs: state 3.11 as the minimum supported version
2026-10-24 00:56:30 -07:00

164 lines
5.2 KiB
YAML
Vendored

name: 🧪 test openbb-us-eia
on:
pull_request:
branches: [develop, main, v5]
paths:
- "openbb_platform/providers/eia/**"
- ".github/workflows/test-unit-openbb-us-eia.yml"
workflow_dispatch:
inputs:
force_catalog_rebuild:
description: "Force the build hook to regenerate the EIA catalog from the live APIv2 metadata tree (ignores actions/cache)."
type: boolean
default: false
permissions:
contents: read
concurrency:
# Cancel in-flight matrix runs when a new commit lands on the same PR.
group: test-openbb-us-eia-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs:
build:
name: Build sdist + wheel
runs-on: ubuntu-latest
defaults:
run:
shell: bash
working-directory: openbb_platform/providers/eia
steps:
- uses: actions/checkout@v6
- uses: actions/setup-python@v6
with:
python-version: "3.11"
- run: python -m pip install --upgrade pip uv
- name: Install the build backend and openbb-core
run: |
uv pip install --system "hatchling>=1.25" "requests>=2.31"
uv pip install --system ../../core
- name: Restore EIA catalog
# ``eia_catalog.json.xz`` is gitignored. On a cache hit the build hook
# reuses it; on a miss it crawls api.eia.gov, which needs EIA_API_KEY.
id: eia-cache
uses: actions/cache@v5
with:
path: openbb_platform/providers/eia/openbb_us_eia/assets/eia_catalog.json.xz
key: eia-catalog-${{ hashFiles('openbb_platform/providers/eia/openbb_us_eia/utils/generate_catalog.py') }}
restore-keys: |
eia-catalog-
- name: Build sdist
env:
OPENBB_EIA_FORCE_CATALOG_REBUILD: ${{ inputs.force_catalog_rebuild == true && '1' || '0' }}
EIA_API_KEY: ${{ secrets.EIA_API_KEY }}
run: uv build --sdist --no-sources --no-build-isolation --python "$(which python)"
- name: Build wheel
env:
OPENBB_EIA_FORCE_CATALOG_REBUILD: "0"
run: uv build --wheel --no-sources --no-build-isolation --python "$(which python)"
- uses: actions/upload-artifact@v5
with:
name: openbb-us-eia-dist
path: openbb_platform/providers/eia/dist/
if-no-files-found: error
retention-days: 7
lint:
name: Lint (ruff + ty)
needs: build
runs-on: ubuntu-latest
defaults:
run:
shell: bash
working-directory: openbb_platform/providers/eia
steps:
- uses: actions/checkout@v6
- uses: actions/setup-python@v6
with:
python-version: "3.11"
- run: python -m pip install --upgrade pip uv
- uses: actions/download-artifact@v5
with:
name: openbb-us-eia-dist
path: openbb_platform/providers/eia/dist
- name: Install dependencies then openbb-us-eia wheel
run: |
uv pip install --system ../../core
uv pip install --system --group dev
uv pip install --system dist/openbb_us_eia-*.whl
- name: ruff check
run: ruff check openbb_us_eia tests hatch_build.py
- name: ruff format --check
run: ruff format --check openbb_us_eia tests hatch_build.py
- name: ty check
run: ty check openbb_us_eia
test:
name: Test (${{ matrix.os }} / Python ${{ matrix.python_version }})
needs: build
strategy:
fail-fast: false
matrix:
include:
# Linux: full sweep across every released Python.
- { 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" }
# macOS + Windows: min and max supported.
- { os: macos-latest, python_version: "3.11" }
- { os: macos-latest, python_version: "3.14" }
- { os: windows-latest, python_version: "3.11" }
- { os: windows-latest, python_version: "3.14" }
runs-on: ${{ matrix.os }}
defaults:
run:
shell: bash
working-directory: openbb_platform/providers/eia
steps:
- uses: actions/checkout@v6
- uses: actions/setup-python@v6
with:
python-version: ${{ matrix.python_version }}
allow-prereleases: true
- uses: actions/download-artifact@v5
with:
name: openbb-us-eia-dist
path: openbb_platform/providers/eia/dist
- run: python -m pip install --upgrade pip uv
- name: Install dependencies then openbb-us-eia wheel
run: |
uv pip install --system ../../core
uv pip install --system --group dev
uv pip install --system dist/openbb_us_eia-*.whl
- name: Test the installed wheel
# Remove the local ``openbb_us_eia/`` source so pytest imports the
# package from site-packages — the exact wheel that was just built.
# The HTTP fetchers replay from tests/record cassettes, so no EIA
# credential is needed here.
run: |
rm -rf openbb_us_eia
pytest tests --cov=openbb_us_eia --cov-report=term-missing --cov-fail-under=100