examples: reposition real-time monitor novelty inset (no longer overl… #10
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
| name: CI | |
| on: | |
| push: | |
| branches: [main] | |
| pull_request: | |
| branches: [main] | |
| permissions: | |
| contents: read | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: true | |
| jobs: | |
| test: | |
| name: tests (Python ${{ matrix.python-version }} on ${{ matrix.os }}) | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| os: [ubuntu-latest, macos-latest] | |
| python-version: ["3.11", "3.12", "3.13"] | |
| steps: | |
| - uses: actions/checkout@v5 | |
| - uses: astral-sh/setup-uv@v5 | |
| with: | |
| enable-cache: true | |
| cache-dependency-glob: 'pyproject.toml' | |
| python-version: ${{ matrix.python-version }} | |
| - name: Sync dev + viz + temporal + duckdb + polars extras | |
| # Viz drives the chart-spec tests; temporal drives changepoint + | |
| # ITS; duckdb drives read_duckdb; polars drives the polars-interop | |
| # tests. Semantic tests use the deterministic HashEmbedder so we | |
| # don't pay the sentence-transformers / torch download cost on | |
| # every CI run. | |
| run: uv sync --extra dev --extra viz --extra temporal --extra duckdb --extra polars | |
| - name: Run ruff | |
| run: uv run ruff check src tests | |
| - name: Run mypy | |
| run: uv run mypy src/pycorpdiff | |
| - name: Run pytest | |
| run: uv run pytest --cov=pycorpdiff --cov-report=term-missing | |
| - name: Upload coverage to Codecov | |
| if: matrix.os == 'ubuntu-latest' && matrix.python-version == '3.12' | |
| uses: codecov/codecov-action@v4 | |
| with: | |
| fail_ci_if_error: false | |
| notebooks: | |
| name: execute example notebooks (drift check) | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v5 | |
| - uses: astral-sh/setup-uv@v5 | |
| with: | |
| enable-cache: true | |
| cache-dependency-glob: 'pyproject.toml' | |
| python-version: "3.12" | |
| # The notebooks are the canonical demos shipped to users; if the | |
| # public API drifts away from what the notebooks expect, either the | |
| # API or the notebook needs to change in the same commit. Failing | |
| # this job surfaces that drift loudly. | |
| - run: uv sync --extra viz --extra temporal --extra polars --extra duckdb --extra notebooks --extra showcase | |
| - run: uv pip install scattertext | |
| - name: Re-execute the tutorial | |
| run: | | |
| uv run jupyter nbconvert --to notebook --execute \ | |
| examples/pycorpdiff_tutorial.ipynb \ | |
| --output /tmp/pycorpdiff_tutorial_executed.ipynb | |
| - name: Re-execute the Hansard demo | |
| run: | | |
| uv run jupyter nbconvert --to notebook --execute \ | |
| examples/hansard_demo.ipynb \ | |
| --output /tmp/hansard_demo_executed.ipynb | |
| - name: Re-execute the showcase | |
| run: | | |
| uv run jupyter nbconvert --to notebook --execute \ | |
| examples/pycorpdiff_showcase.ipynb \ | |
| --output /tmp/pycorpdiff_showcase_executed.ipynb | |
| crossval-slow: | |
| name: cross-validation (slow tier — NLTK + Scattertext + HistWords + SBERT) | |
| # Only on main pushes — the heavy environment (NLTK + sentence- | |
| # transformers model download) would make every PR slow. The | |
| # receipts in the README only need to be backed by CI on the | |
| # published main branch. HistWords + SBERT tests skip cleanly when | |
| # external resources (Stanford SNAP / HuggingFace Hub) are | |
| # unreachable. | |
| if: github.event_name == 'push' | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v5 | |
| - uses: astral-sh/setup-uv@v5 | |
| with: | |
| enable-cache: true | |
| cache-dependency-glob: 'pyproject.toml' | |
| python-version: '3.12' | |
| - name: Sync Python deps (dev + all + nltk + scattertext) | |
| run: | | |
| uv sync --extra dev --extra all | |
| uv pip install nltk scattertext | |
| - name: Run slow-tier cross-validation tests | |
| # HistWords tests skip cleanly when Stanford SNAP is unreachable | |
| # or the COHA archive can't be extracted; this is treated as | |
| # "no signal", not a failure. | |
| run: uv run pytest -q -m slow tests/integration/ |