Skip to content

Replace tox and pip with uv - #507

Open
dweindl wants to merge 1 commit into
PEtab-dev:mainfrom
dweindl:replace-tox-pip-with-uv
Open

Replace tox and pip with uv#507
dweindl wants to merge 1 commit into
PEtab-dev:mainfrom
dweindl:replace-tox-pip-with-uv

Conversation

@dweindl

@dweindl dweindl commented Aug 10, 2026

Copy link
Copy Markdown
Member

Why

tox and pip split dependency/environment management across two tools:
pip installs packages, tox orchestrates per-purpose virtualenvs
(quality/unit/doc) on top of it. uv replaces both with a single fast
tool that handles dependency resolution/installation, Python version
management, virtualenv creation, and building sdists — fewer moving
parts for contributors to learn, and noticeably faster CI installs.

Summary

  • Replace tox + pip with uv across dev tooling, CI, and the release workflow.
  • CI (ci_tests.yml): astral-sh/setup-uv installs uv + the matrix Python version (with built-in caching); tox -e quality -> uvx pre-commit run --all-files; tox -e unit -> uv sync --group ci + uv run pytest. The "3.x" matrix wildcard is replaced with an explicit "3.14", since setup-uv needs exact versions.
  • Release (deploy.yml): pip install setuptools wheel build && python -m build -s -> uv build --sdist.
  • The two CI-only git dependencies previously listed in tox.ini's unit env deps= (petabtests, benchmark_models_petab), plus the tests/reports/combine/vis extras, now live in a single PEP 735 [dependency-groups] ci group in pyproject.toml (via a self-referential petab[tests,reports,combine,vis] entry) — confirmed dependency-groups are excluded from built distribution metadata, so PyPI's rejection of direct/VCS references doesn't apply here.
  • No uv.lock is committed — this is a library, so CI keeps resolving against current constraints each run, matching the previous un-pinned tox/pip behavior.
  • Removed tox.ini and requirements-dev.txt (only contained tox>=3.26.0).
  • Updated doc/development.rst dev-workflow commands to use uv sync/uv run/uvx.
  • Fixed README.md's stated Python requirement (>=3.11 -> >=3.12) to match pyproject.toml's requires-python.
  • Added [tool.uv] constraint-dependencies = ["pysb>=1.17.0"]: uv resolves one dependency graph across all declared extras (not just the ones requested for a given sync), so the unit-test job was transitively pulling in pysb via the unrelated doc extra and landing on 1.16.0, whose legacy build bootstrap hits a dead URL. Pinning the resolver to >=1.17.0 avoids it without changing the public tests/doc extras' declared ranges.

Not changed (flagged, out of scope)

  • .readthedocs.yaml stays on pip — Read the Docs' python.install only supports pip/setuptools natively; using uv there needs custom build.commands overrides.
  • Contributors lose the single tox -e <name> entrypoint in favor of direct uv run/uvx commands.

Test plan

  • uv build --sdist produces an equivalent sdist to the previous python -m build -s.
  • uv sync --group ci resolves and installs correctly (verified petabtests and benchmark_models_petab install from git, and the full test suite passes locally: 378 passed, 4 skipped).
  • uvx pre-commit run --all-files behaves like the old tox -e quality.
  • CI (ci_tests.yml) passes across the full OS x Python-version matrix on this PR.
  • deploy.yml succeeds on the next release (can't be tested pre-merge).

🤖 Generated with Claude Code

@codecov-commenter

codecov-commenter commented Aug 10, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 75.30%. Comparing base (3646706) to head (cd854e6).

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #507   +/-   ##
=======================================
  Coverage   75.30%   75.30%           
=======================================
  Files          64       64           
  Lines        7353     7353           
  Branches     1327     1327           
=======================================
  Hits         5537     5537           
  Misses       1310     1310           
  Partials      506      506           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

tox and pip split dependency/environment management across two tools:
pip installs packages, tox orchestrates per-purpose virtualenvs
(quality/unit/doc) on top of it. uv replaces both with a single fast
tool that handles dependency resolution/installation, Python version
management, virtualenv creation, and building sdists - fewer moving
parts for contributors to learn, and noticeably faster CI installs.

- CI (`ci_tests.yml`): `astral-sh/setup-uv` installs uv + the matrix
  Python version (with built-in caching); `tox -e quality` becomes
  `uvx pre-commit run --all-files`; `tox -e unit` becomes
  `uv sync --group ci` + `uv run pytest`. The `"3.x"` matrix wildcard is
  replaced with an explicit `"3.14"`, since `setup-uv` needs exact
  versions.
- Release (`deploy.yml`): `pip install setuptools wheel build &&
  python -m build -s` becomes `uv build --sdist`.
- The CI-only git dependencies previously listed in `tox.ini`'s `unit`
  env `deps=` (`petabtests`, `benchmark_models_petab`), plus the
  `tests`/`reports`/`combine`/`vis` extras, now live in a single PEP 735
  `[dependency-groups]` `ci` group in `pyproject.toml` (via a
  self-referential `petab[tests,reports,combine,vis]` entry) -
  dependency-groups are excluded from built distribution metadata, so
  PyPI's rejection of direct/VCS references doesn't apply here.
- No `uv.lock` is committed - this is a library, so CI keeps resolving
  against current constraints each run, matching the previous
  un-pinned tox/pip behavior.
- Added `[tool.uv] constraint-dependencies = ["pysb>=1.17.0"]`: uv
  resolves one dependency graph across all declared extras, not just
  the ones requested for a given sync, so the unit-test job was
  transitively pulling in pysb via the unrelated `doc` extra and
  landing on 1.16.0, whose legacy build bootstrap hits a dead URL.
  Pinning the resolver to >=1.17.0 avoids it without changing the
  public `tests`/`doc` extras' declared ranges.
- Removed `tox.ini` and `requirements-dev.txt` (only contained
  `tox>=3.26.0`).
- Updated `doc/development.rst` dev-workflow commands to use
  `uv sync`/`uv run`/`uvx`.
- Fixed `README.md`'s stated Python requirement (`>=3.11` -> `>=3.12`)
  to match `pyproject.toml`'s `requires-python`.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@dweindl
dweindl force-pushed the replace-tox-pip-with-uv branch from b0aafd9 to cd854e6 Compare August 10, 2026 17:24
@dweindl
dweindl marked this pull request as ready for review August 10, 2026 17:48
@dweindl
dweindl requested a review from a team as a code owner August 10, 2026 17:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants