Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
## Summary
<!-- Bullet points of what this PR does -->
<!-- Bullet points of what this PR does
Include every user-visible change and behavior note, and leave CHANGELOG.md alone: each release's notes are written from these summaries -->

## Testing
- [ ] `uv run ruff check .` passes
Expand Down
24 changes: 24 additions & 0 deletions .github/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Categories for the release notes GitHub generates from merged pull requests. "Other changes"
# collects every pull request that matches no earlier category (labels: "*").
changelog:
exclude:
labels:
- duplicate
- invalid
- wontfix
categories:
- title: Enhancements
labels:
- enhancement
- title: Bug fixes
labels:
- bug
- title: Documentation
labels:
- documentation
- title: Dependencies
labels:
- dependencies
- title: Other changes
labels:
- "*"
11 changes: 10 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ jobs:
- "!pyrightconfig.json"
- "!.github/ISSUE_TEMPLATE/**"
- "!.github/PULL_REQUEST_TEMPLATE.md"
- "!.github/release.yml"
- "!.github/workflows/ci-example.yml"
- "!.github/workflows/docs.yml"
- "!docs/**"
Expand Down Expand Up @@ -110,10 +111,18 @@ jobs:
# test that sets propagate=True captures each record twice, and from rich 14.3.4 importing
# httpx draws from Python's global random, which moves the RNG stream that
# test_streaming_resume.py checks.
# --exclude-newer installs only releases uploaded before the cutoff, so the packages no bound
# fixes, such as the dependencies' own dependencies, stay the same from run to run, and a new
# release of one of them alone cannot turn this leg red. A PR that raises a bound, or adds a
# dependency, to a release uploaded after the cutoff moves the date forward in the same PR,
# to a time already past at which this leg passes, in the same UTC form (uv reads a bare
# date in the runner's time zone, through the end of that day); the PR's own run of the leg
# tests it.
- name: Install every runtime dependency at its lower bound
run: >-
uv pip install --resolution lowest-direct -e . --group video
"pytest>=9.0.2" "pytest-timeout>=2.4.0" --constraint <(echo "rich<14.3.4")
--exclude-newer 2026-12-05T00:00:00Z
- run: uv pip list
# lowest-direct installs the lowest version the other requirements allow, not the declared
# bound, so a bound set below what they allow would pass here without ever being installed.
Expand Down Expand Up @@ -149,7 +158,7 @@ jobs:
- if: needs.changes.outputs.code != 'true' && needs.changes.outputs.doc_pages == 'true'
run: test "${{ needs.unit-tests-doc-pages.result }}" = "success"

gpu-tests:
integration-cpu:
runs-on: ubuntu-latest
if: github.event_name == 'workflow_dispatch'
steps:
Expand Down
7 changes: 5 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,7 @@ Include `Closes #N` to auto-close the issue on merge.
- Keep PRs focused. One feature or fix per PR.
- If your change is large, break it into smaller PRs that each leave the codebase in a working state.
- Respond to review comments. Push follow-up commits (don't force-push during review).
- Leave `CHANGELOG.md` alone: open PRs that each add an entry there conflict with one another. Put every user-visible change and behavior note in the PR's Summary instead. Each release's section of `CHANGELOG.md` is written when the release is cut, from GitHub's generated release notes, which group the merged PRs by label (`.github/release.yml`), and from those Summaries.

## Code Style

Expand Down Expand Up @@ -211,9 +212,11 @@ CI runs on every push to `main` and every PR. Every job that runs must pass befo
|-----|----------------|---------|
| `lint` | `ruff check` + `ruff format --check` + `pyright` | Every push/PR |
| `unit-tests` | `pytest tests/unit/ -v --timeout=60` on Python 3.12 and 3.14 with `uv.lock`, and on Python 3.12 with every runtime dependency at its lower bound in `pyproject.toml` (the `unit-tests (dependency floors)` leg, which first checks that each one is installed at exactly that bound) | Manual dispatch, and pushes/PRs that change a file outside `docs/`, `examples/`, `plugins/`, `benchmarks/` and the repository files the workflow's `changes` job lists (such as `README.md`, `CONTRIBUTING.md` and `codebase-map.json`). When every changed file is in that set and one of them is `README.md` or a `.md` page under `docs/`, `examples/` or `plugins/`, the `unit-tests (doc pages)` job runs just the test that reads those pages |
| `gpu-tests` | `pytest tests/integration/` | Manual dispatch |
| `integration-cpu` | `pytest tests/integration/ -m "not slow"` on a CPU runner, so the integration tests that need a GPU skip | Manual dispatch |
| `<example>-tests` | `examples/<example>/tests` in one pytest session, manual-only tiers excluded | Pushes/PRs touching `examples/<example>/`, `kempnerforge/`, `pyproject.toml`, `uv.lock` or the workflow |

Every job runs on a CPU runner. No workflow runs the GPU tiers (`tests/distributed/`, `tests/e2e/` and `tests/smoke/`) or the integration tests that need a GPU, so run the ones your change affects on GPUs yourself (see GPU Access on SLURM Clusters and Step 3). The Codecov report and the coverage badge in `README.md` count the unit tests alone.

The most common CI failure is `ruff format --check`. Run `uv run ruff format --check .` locally before pushing.

## Testing
Expand Down Expand Up @@ -499,7 +502,7 @@ uv add --group dev <package>

Always use `uv`, never pip, conda, or venv. PyTorch is pinned to the CUDA 13.0 index in `pyproject.toml`.

Every runtime dependency needs a lower bound (`uv add` writes one at the version it resolves), and every library `kempnerforge` imports must be declared, even one another dependency already installs; `tests/unit/test_check_dependency_floors.py` checks both. The `unit-tests (dependency floors)` CI leg installs each runtime dependency at its lower bound and runs the unit tests, so a bound must be a version the code works with. Its install takes the lowest version the other requirements allow, which is newer than a bound set below that, so the leg first runs `scripts/check_dependency_floors.py`: it fails, naming each one, when a dependency in `[project].dependencies` or the `video` group is installed at a version other than its lower bound, is missing, or declares no inclusive lower bound (`>=`, `~=` or `==`). Raise such a bound to the version the leg installed, and lower a bound only after that leg passes with it.
Every runtime dependency needs a lower bound (`uv add` writes one at the version it resolves), and every library `kempnerforge` imports must be declared, even one another dependency already installs; `tests/unit/test_check_dependency_floors.py` checks both. The `unit-tests (dependency floors)` CI leg installs each runtime dependency at its lower bound and runs the unit tests, so a bound must be a version the code works with. Its install takes the lowest version the other requirements allow, which is newer than a bound set below that, so the leg first runs `scripts/check_dependency_floors.py`: it fails, naming each one, when a dependency in `[project].dependencies` or the `video` group is installed at a version other than its lower bound, is missing, or declares no inclusive lower bound (`>=`, `~=` or `==`). Raise such a bound to the version the leg installed, and lower a bound only after that leg passes with it. The install takes only releases uploaded before the cutoff date it passes to `--exclude-newer`, so the packages no bound fixes stay the same from run to run. A bound, or a new dependency, whose release is newer than the cutoff does not resolve there: move the date in `.github/workflows/ci.yml` forward in the same PR, to a time already past at which the leg passes, as a UTC timestamp.

## Quick Reference

Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<p align="center">
<a href="https://github.com/KempnerInstitute/KempnerForge/actions/workflows/ci.yml"><img src="https://github.com/KempnerInstitute/KempnerForge/actions/workflows/ci.yml/badge.svg" alt="CI"/></a>
<a href="https://github.com/KempnerInstitute/KempnerForge/actions/workflows/docs.yml"><img src="https://github.com/KempnerInstitute/KempnerForge/actions/workflows/docs.yml/badge.svg" alt="Docs"/></a>
<a href="https://codecov.io/gh/KempnerInstitute/KempnerForge"><img src="https://codecov.io/gh/KempnerInstitute/KempnerForge/graph/badge.svg?token=JvU079LEsl" alt="codecov"/></a>
<a href="https://codecov.io/gh/KempnerInstitute/KempnerForge"><img src="https://codecov.io/gh/KempnerInstitute/KempnerForge/graph/badge.svg?token=JvU079LEsl" alt="codecov: unit tests only" title="Coverage of the unit tests (tests/unit/) alone: CI runs no GPU tests"/></a>
<a href="LICENSE"><img src="https://img.shields.io/badge/License-MIT-blue.svg" alt="License: MIT"/></a>
<a href="https://www.python.org/downloads/"><img src="https://img.shields.io/badge/python-3.12+-blue.svg" alt="Python 3.12+"/></a>
<a href="https://pytorch.org/"><img src="https://img.shields.io/badge/pytorch-2.12+-ee4c2c.svg" alt="PyTorch 2.12+"/></a>
Expand Down Expand Up @@ -260,7 +260,7 @@ tests/ # unit, integration, distributed, and end-to-end tests

## Contributing

See [`CONTRIBUTING.md`](CONTRIBUTING.md) for the editor loop, build commands, and style conventions.
See [`CONTRIBUTING.md`](CONTRIBUTING.md) for the editor loop, build commands, and style conventions. CI runs on CPU runners only: the coverage badge counts the unit tests (`tests/unit/`) alone, and the GPU tests run by hand.

## License

Expand Down
10 changes: 10 additions & 0 deletions docs/getting-started/install.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,16 @@ The floors are tested on Python 3.12 only: some of the oldest releases, such as
Pillow 10.0.0, PyYAML 6.0.1 and NumPy 1.26.1, publish no wheels for Python 3.13
or newer.

The packages that no bound fixes, such as the dependencies of the dependencies,
install at the newest release the other requirements allow among those uploaded
before a fixed cutoff date, which the job passes to
`uv pip install --exclude-newer`. A new release of one of those packages
therefore cannot change what the job installs, or turn it red on its own. The
cutoff applies to the bounds too: a change that raises a bound, or adds a
dependency, to a release uploaded after the cutoff also moves the date forward
in `ci.yml`, to a time already past at which the job passes, written as a UTC
timestamp.

## Optional: docs dependencies

If you plan to preview docs locally, add the `docs` dependency group:
Expand Down
Loading