CI: Speed up Python 3.13 tests — resolve numpy 2.x pre-built wheels - #161
CI: Speed up Python 3.13 tests — resolve numpy 2.x pre-built wheels#161MarcelRosier wants to merge 6 commits into
Conversation
…kflow - Pin actions/checkout, actions/setup-python, astral-sh/setup-uv, codecov/codecov-action, stefanzweifel/git-auto-commit-action to commit SHAs - Bump actions to latest releases (checkout v7, setup-python v7, setup-uv v9, codecov v7, git-auto-commit v7) - Add .github/dependabot.yml with weekly github-actions ecosystem updates - Remove autoformat.yml (redundant with pre-commit hooks + ruff CI check)
…hub-actions-add-dependabot
Add 'numpy>=2.1; python_version>='3.13'' constraint so uv resolves numpy 2.5.1 (with cp313 manylinux wheels) instead of numpy 1.26.4 (no cp313 wheel, compiles from source in ~2m50s). Constrain brainles_preprocessing optional dep to < 3.13 since it pins numpy<2.0 and conflicts with numpy 2.x. Closes #160
There was a problem hiding this comment.
Pull request overview
Updates dependency constraints and CI tooling to avoid building numpy from source on Python 3.13 (by resolving to a numpy 2.x wheel), alongside the broader uv/hatch migration and CI hardening changes referenced in the PR description.
Changes:
- Add a Python 3.13-specific numpy constraint (>=2.1) and restrict the
preprocessingextra to<3.13due to its numpy<2.0 pin. - Migrate packaging metadata/build backend to hatchling/hatch-vcs and move dev/docs deps into PEP 735 dependency groups.
- Update CI/RTD configuration to use
uv, SHA-pin GitHub Actions, add Dependabot, and remove the autoformat workflow.
Reviewed changes
Copilot reviewed 8 out of 11 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| pyproject.toml | Add numpy 3.13 marker constraint; switch build backend to hatch; define dependency groups and optional dependency marker. |
| CONTRIBUTING.md | Update contributor setup commands from Poetry to uv. |
| .readthedocs.yaml | Switch RTD installation to use uv sync with the docs group. |
| .gitignore | Ignore hatch-vcs generated brats/_version.py. |
| .github/workflows/tests.yml | Use setup-uv and uv sync --frozen; SHA-pin checkout/codecov actions. |
| .github/workflows/ruff.yml | SHA-pin checkout action. |
| .github/workflows/release.yml | SHA-pin checkout/setup-python and fetch full history (needed for VCS versioning). |
| .github/workflows/autoformat.yml | Remove the comment-triggered autoformat workflow. |
| .github/dependabot.yml | Add Dependabot configuration for GitHub Actions updates. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
…py-2x-pre-built-wheels
There was a problem hiding this comment.
Blocking: The < 3.13 constraint on brainles_preprocessing is a workaround until BrainLesion/preprocessing#187 (relaxing numpy<2.0) is merged and released.
Once a new brainles_preprocessing version lands on PyPI with numpy 2.x support, we should:
- Bump
brainles_preprocessingminimum version to that release - Remove the
python_version < '3.13'marker from the preprocessing optional dep - Re-run
uv lock
Update: resolved
brainles_preprocessing 0.6.13 drops its numpy<2.0 pin, so the interim < 3.13 workaround is no longer needed. Python 3.13 users can now install the preprocessing extra with numpy 2.x. Refs: BrainLesion/preprocessing#187
…py-2x-pre-built-wheels
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 6 out of 7 changed files in this pull request and generated no new comments.
Suppressed comments (2)
pyproject.toml:49
- The numpy constraints overlap for Python >=3.13 (both this line and the >=2.1 line apply). It’s clearer (and avoids accidentally allowing numpy 2.x on 3.10–3.12 if other deps start supporting it) to make the markers mutually exclusive and explicitly cap numpy<2 for <3.13, matching the stated intent of keeping numpy 1.26.x on 3.9–3.12.
"numpy>=1.21.0; python_version<='3.9'",
"numpy>=2.1; python_version>='3.13'",
"numpy>=1.26.0; python_version>='3.10'",
pyproject.toml:53
- PR description says the
preprocessingextra is constrained to Python <3.13 due to an upstream numpy<2 pin, but this optional dependency still allows 3.13+. Also,uv.locknow resolvesbrainles-preprocessingwith numpy 2.3.5 for Python >=3.13, so the rationale in the PR description may be outdated. Either update the PR description to reflect the new upstream compatibility, or add an explicit< '3.13'marker here if you still want to restrict the extra.
preprocessing = ["brainles_preprocessing>=0.6.13; python_version >= '3.10'"]
Summary
Resolves #160.
Problem
Python 3.13 CI install step takes ~2m50s (vs ~1s for 3.9–3.12) because numpy 1.26.4 has no cp313 pre-built wheel, forcing
uv syncto compile numpy from source.Fix
numpy>=2.1; python_version>='3.13'constraint — uv now resolves numpy 2.5.1 with cp313 manylinux wheels for Python 3.13, while keeping numpy 1.26.4 for 3.9–3.12.brainles_preprocessingoptional dep to< 3.13since it pinsnumpy<2.0.Compatibility
No code changes needed — the only numpy usage is
np.count_nonzero()inbrats/core/docker.py:348andnp.ones()/np.zeros()in tests, all fully compatible with numpy 2.x.