Document model inversion, and pin the constants the book quotes (#478) #1208
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # This workflow will install Python dependencies and run tests with a variety of Python versions | |
| # For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions | |
| name: Unit tests | |
| on: | |
| push: | |
| branches: [main] | |
| pull_request: | |
| branches: ['**'] | |
| create: | |
| branches: [main] | |
| tags: ['**'] | |
| # schedule: | |
| # - cron: "0 4 * * *" | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} | |
| # Only cancel redundant in-progress runs for pull requests. Pushes to main | |
| # share a single concurrency group (no pull_request.number), so a blanket | |
| # cancel-in-progress would abort an earlier merge commit's run as soon as the | |
| # next commit lands, leaving it marked as cancelled rather than tested. | |
| cancel-in-progress: ${{ github.event_name == 'pull_request' }} | |
| jobs: | |
| lint: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v7 | |
| - name: Install uv and set the python version | |
| uses: astral-sh/setup-uv@v7 | |
| with: | |
| python-version: "3.13" | |
| - name: Install the project (editable) | |
| run: uv sync --dev --all-extras | |
| - name: Lint with ruff | |
| run: uv run ruff check . | |
| # ENG-20 / ENG-03 (#285): mypy runs on every PR as a BLOCKING check. | |
| # The historical ~333-error backlog was driven to zero (staged cleanup), | |
| # so the job no longer carries `continue-on-error`; a new type error now | |
| # turns CI red. mypy is upper-bounded in the dev deps so a future mypy | |
| # release cannot silently break this gate. | |
| typecheck: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v7 | |
| - name: Install uv and set the python version | |
| uses: astral-sh/setup-uv@v7 | |
| with: | |
| python-version: "3.13" | |
| - name: Install the project (editable) | |
| run: uv sync --dev --all-extras | |
| - name: Type-check with mypy | |
| run: uv run mypy src/process_improve | |
| test: | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| # Adjust for min and max supported Python versions | |
| python-version: ["3.13"] | |
| os: [ubuntu-latest, windows-latest, macos-latest] | |
| experimental: [false] | |
| include: | |
| - python-version: "3.10" | |
| os: ubuntu-latest | |
| experimental: false | |
| - python-version: "3.11" | |
| os: ubuntu-latest | |
| experimental: false | |
| - python-version: "3.12" | |
| os: ubuntu-latest | |
| experimental: false | |
| # Free-threaded (no-GIL) Python (3.13t / 3.14t) is intentionally NOT | |
| # tested yet. Several dependencies still lack free-threaded (cp31Xt) | |
| # wheels and fall back to building from source, which fails on the | |
| # GitHub-hosted images: llvmlite (via numba / the `fast` extra) needs | |
| # LLVM 20, and Rust-built deps (e.g. pydantic-core and some mcp | |
| # transitives) fail their maturin/cargo source builds. These rows | |
| # only ever failed at install and produced no useful signal, so they | |
| # are removed rather than left as a permanent non-blocking red check. | |
| # Re-add them once the free-threaded wheel ecosystem has caught up | |
| # (tracked in issue #43). | |
| runs-on: ${{ matrix.os }} | |
| continue-on-error: ${{ matrix.experimental }} | |
| defaults: | |
| run: | |
| shell: bash -e {0} | |
| steps: | |
| - uses: actions/checkout@v7 | |
| with: | |
| fetch-depth: 0 | |
| - name: Install uv and set the python version | |
| uses: astral-sh/setup-uv@v7 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| # Test building & distribution | |
| - name: Test building the distributions | |
| run: uv build | |
| - name: Check if the built package can be installed and imported | |
| run: uv run --isolated --with . --no-project -- python -c "import process_improve" | |
| # Editable install for testing | |
| - name: Install the project (editable) | |
| run: uv sync --dev --all-extras | |
| # This is where the actual unit and integration tests start | |
| - name: Test with pytest | |
| run: uv run pytest --cov-report=xml | |
| - name: Upload coverage to Codecov | |
| if: matrix.os == 'ubuntu-latest' && matrix.python-version == '3.13' | |
| uses: codecov/codecov-action@v7 | |
| with: | |
| files: ./coverage.xml | |
| token: ${{ secrets.CODECOV_TOKEN }} | |
| fail_ci_if_error: false | |
| # ENG-15 sub-track: catch validation `assert`s stripped by `python -O`. | |
| # SEC-08 swept ~105 sites; SEC-17 (#266) swept the multivariate / bivariate / | |
| # batch / experiments / monitoring sites that survived. This job now runs as | |
| # a blocking check so a regression turns CI red. | |
| test-under-dash-O: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v7 | |
| - name: Install uv and set the python version | |
| uses: astral-sh/setup-uv@v7 | |
| with: | |
| python-version: "3.13" | |
| - name: Install the project (editable) | |
| run: uv sync --dev --all-extras | |
| - name: Test with pytest under python -O | |
| # Strip the default --cov / --pdb / -n auto / --exitfirst options; | |
| # for -O detection we want the full failure surface, not the first one. | |
| run: uv run python -O -m pytest -o "addopts=" -v --tb=short |