Skip to content

[MAINT] use uv & tox, drop python 3.9#262

Open
Remi-Gau wants to merge 7 commits intocpp-lln-lab:mainfrom
Remi-Gau:maint/uv
Open

[MAINT] use uv & tox, drop python 3.9#262
Remi-Gau wants to merge 7 commits intocpp-lln-lab:mainfrom
Remi-Gau:maint/uv

Conversation

@Remi-Gau
Copy link
Contributor

@Remi-Gau Remi-Gau commented Mar 23, 2026

  • drop python 3.9
  • use uv to generate requirements
  • use tox to run tests
  • use dependency groups

@sourcery-ai
Copy link

sourcery-ai bot commented Mar 23, 2026

Reviewer's Guide

Switches the project to uv for dependency management and tox-uv based workflows, simplifying dependency specification, aligning supported Python versions and CI/Docker images, and adding a uv lockfile.

Flow diagram for dependency management with uv and tox-uv

flowchart TD
    A[Edit pyproject_toml] --> B[Compile dependencies with uv<br>uv pip compile pyproject.toml -o requirements.txt --python-version 3_11_15 --no-deps]
    B --> C[Generate requirements_txt]
    B --> D[Generate uv_lock]

    subgraph Local_Testing
        E[Run tox -e test]
        E --> F[tox_uv resolves dependency_groups test]
        F --> G[Install test dependencies via uv]
        G --> H[Run pytest with coverage]
    end

    subgraph Linting
        I[Run tox -e lint]
        I --> J[Install pre_commit]
        J --> K[Run pre_commit hooks]
    end

    subgraph CI_Pipeline
        L[GitHub Actions test_and_coverage]
        L --> M[Use tox with tox_uv]
        M --> N[Install deps via uv using uv_lock]
        N --> O[Run tests and generate coverage]
    end
Loading

File-Level Changes

Change Details Files
Regenerate requirements.txt using uv with a reduced, direct-dependency-only set and updated pinned versions.
  • Replace pip-compile header with uv pip compile header including python version and --no-deps flags.
  • Remove transitive dependency listings, keeping only direct project dependencies with updated versions.
  • Update specific pins for deepmreye, kaleido, pooch, pybids, rich-argparse, tqdm, and related packages.
requirements.txt
Restructure dependency configuration in pyproject.toml to use hatch dependency-groups, tighten Python version support, and remove legacy optional extras.
  • Add [dependency-groups] section defining dev, doc, and test groups including tox, tox-uv, and pre-commit.
  • Remove [project.optional-dependencies] extras in favor of dependency groups and simplify docs/test configuration.
  • Constrain requires-python to >=3.10.0,<3.12 to match supported/runtime environments.
  • Remove Black configuration section now unused or handled elsewhere.
pyproject.toml
Refactor tox configuration to use tox-uv, centralize environment variables, and run tests via a dedicated test environment using dependency_groups.
  • Add tox-uv to [tox] requires so uv is used as the backend resolver/installer.
  • Introduce [global_var] section to centralize common passenv variables including CI and color-related env vars.
  • Define [testenv:test] that installs dependencies from the test dependency group and runs pytest with coverage.
  • Simplify [testenv:lint] to only depend on pre-commit and remove legacy style/import-linter and update_dependencies environments that relied on pip-tools.
tox.ini
Update GitHub Actions CI to install uv, run tests via tox with tox-uv/gh-actions, and align Python matrix with supported versions.
  • Reduce Python test matrix to 3.10 and 3.11, dropping 3.9 in line with new requires-python constraint.
  • Install uv using astral-sh/setup-uv and use uv tool install to install tox with tox-uv and tox-gh-actions.
  • Replace direct pytest invocation with tox run -e test and add a step to show tox config (tox c).
.github/workflows/test_and_coverage.yml
Tune automation schedules for dependency and hook updates to run less frequently.
  • Change Dependabot github-actions and gitsubmodule schedules from monthly to semiannually.
  • Change pre-commit CI autoupdate_schedule from monthly to quarterly.
.github/dependabot.yml
.pre-commit-config.yaml
Align Docker image with new Python baseline and install tooling prerequisites for uv.
  • Update base image to python:3.11.15-slim with a new pinned digest.
  • Extend apt-get install to include curl and ca-certificates alongside git, needed for uv tooling and HTTPS.
  • Keep existing model directory setup intact.
Dockerfile
Add uv-generated lockfile to pin full dependency resolution.
  • Introduce uv.lock at repository root to capture resolved dependencies for reproducible installs.
uv.lock

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

Copy link

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

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

Hey - I've found 1 issue, and left some high level feedback:

  • Removing the existing [project.optional-dependencies] extras ([dev], [doc], [docs], [style], [test], [tests]) is a breaking change for consumers that install bidsmreye[...]; consider reintroducing these extras and mapping them to the new [dependency-groups] so external workflows keep working while you migrate to uv groups internally.
  • Now that [dependency-groups] are defined, you may want to use them consistently in tox.ini (e.g. have lint also pull from dev instead of spelling out pre-commit) and in any Docker/automation setup that still relies on .[test]/.[dev] installs, so there is a single source of truth for dev/test dependencies.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- Removing the existing `[project.optional-dependencies]` extras (`[dev]`, `[doc]`, `[docs]`, `[style]`, `[test]`, `[tests]`) is a breaking change for consumers that install `bidsmreye[...]`; consider reintroducing these extras and mapping them to the new `[dependency-groups]` so external workflows keep working while you migrate to uv groups internally.
- Now that `[dependency-groups]` are defined, you may want to use them consistently in `tox.ini` (e.g. have `lint` also pull from `dev` instead of spelling out `pre-commit`) and in any Docker/automation setup that still relies on `.[test]`/`.[dev]` installs, so there is a single source of truth for dev/test dependencies.

## Individual Comments

### Comment 1
<location path="tox.ini" line_range="12-21" />
<code_context>
+[global_var]
+passenv =
+    CI
+    USERNAME
+    # Pass user color preferences through
+    PY_COLORS
</code_context>
<issue_to_address>
**suggestion:** Consider also passing `USER` for non-Windows environments that don’t set `USERNAME`.

On many Linux/macOS systems only `USER` is set, so tooling that depends on the username may not work as expected with only `USERNAME` in `passenv`. Including `USER` would improve cross-platform robustness.

```suggestion
[global_var]
passenv =
    CI
    USERNAME
    USER
    # Pass user color preferences through
    PY_COLORS
    FORCE_COLOR
    NO_COLOR
    CLICOLOR
    CLICOLOR_FORCE
```
</issue_to_address>

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@codecov
Copy link

codecov bot commented Mar 23, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 81.73%. Comparing base (1bcca23) to head (07614d8).
⚠️ Report is 123 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #262      +/-   ##
==========================================
+ Coverage   79.91%   81.73%   +1.82%     
==========================================
  Files          13       16       +3     
  Lines         926     1046     +120     
  Branches      119        0     -119     
==========================================
+ Hits          740      855     +115     
- Misses        144      191      +47     
+ Partials       42        0      -42     
Flag Coverage Δ
tests 81.73% <ø> (+1.93%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 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.

@Remi-Gau Remi-Gau changed the title [MAINT] use uv [MAINT] use uv & tox, drop python 3.9 Mar 23, 2026
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.

1 participant