Skip to content

CI: Speed up Python 3.13 tests — resolve numpy 2.x pre-built wheels - #161

Open
MarcelRosier wants to merge 6 commits into
mainfrom
160-ci-speed-up-python-313-tests-resolve-numpy-2x-pre-built-wheels
Open

CI: Speed up Python 3.13 tests — resolve numpy 2.x pre-built wheels#161
MarcelRosier wants to merge 6 commits into
mainfrom
160-ci-speed-up-python-313-tests-resolve-numpy-2x-pre-built-wheels

Conversation

@MarcelRosier

Copy link
Copy Markdown
Collaborator

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 sync to compile numpy from source.

Fix

  • Add 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.
  • Constrain brainles_preprocessing optional dep to < 3.13 since it pins numpy<2.0.

Compatibility

No code changes needed — the only numpy usage is np.count_nonzero() in brats/core/docker.py:348 and np.ones()/np.zeros() in tests, all fully compatible with numpy 2.x.


Important: This PR is based on #158 and #159. Please review and merge those first.

…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)
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
Copilot AI lite review requested due to automatic review settings August 8, 2026 11:34
@MarcelRosier MarcelRosier self-assigned this Aug 8, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 preprocessing extra to <3.13 due 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.

Comment thread pyproject.toml

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 8 out of 11 changed files in this pull request and generated no new comments.

@MarcelRosier MarcelRosier left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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:

  1. Bump brainles_preprocessing minimum version to that release
  2. Remove the python_version < '3.13' marker from the preprocessing optional dep
  3. 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
@neuronflow
neuronflow requested a balanced review from Copilot August 9, 2026 20:30

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 preprocessing extra is constrained to Python <3.13 due to an upstream numpy<2 pin, but this optional dependency still allows 3.13+. Also, uv.lock now resolves brainles-preprocessing with 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'"]

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.

CI: Speed up Python 3.13 tests — resolve numpy 2.x pre-built wheels

2 participants