Skip to content

Make project dependencies uv compatible#1408

Merged
rly merged 12 commits intodevfrom
make_project_dependencies_uv_compatible
Mar 2, 2026
Merged

Make project dependencies uv compatible#1408
rly merged 12 commits intodevfrom
make_project_dependencies_uv_compatible

Conversation

@h-mayorquin
Copy link
Contributor

@h-mayorquin h-mayorquin commented Feb 25, 2026

I have been working with uv lately and would like to make this package compatible with it. Currently uv lock and uv run fail because the resolver cannot build a single lockfile that satisfies all dependency groups and extras together: test-min-deps pins numpy==1.22.0 while hdmf-zarr (via the zarr extra) requires numpy>=1.24.0, test-min-deps pins jsonschema==3.2.0 while linkml (via the termset extra) requires jsonschema>=4.0.0, and pinned versions like pandas==1.4.0 cannot even build on Python >=3.12. In short, the dependencies are locally consistent but not globally.

To fix this, this PR:

  • Raises the dependency lower bounds for h5py, numpy, and pandas to versions that are installable on Python >=3.12
  • Adds python_version == '3.10' markers to all test-min-deps pins so the resolver does not attempt to use them on newer Python versions
  • Declares [tool.uv] conflicts between test-min-deps and the optional extras (all, zarr, termset) so uv resolves them in separate forks.

The last addition is the only one that is uv-specific, the first two are standard PEP 508/PEP 735 dependency specifications and should help any resolver while making the specification more precise.

If this make sense maybe it should go after the next release to avoid introducing risk into the current release cycle.

Checklist

  • Did you update CHANGELOG.md with your changes?
  • Does the PR clearly describe the problem and the solution?
  • Have you reviewed our Contributing Guide?
  • Does the PR use "Fix #XXX" notation to tell GitHub to close the relevant issue numbered XXX when the PR is merged?

@codecov
Copy link

codecov bot commented Feb 25, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 92.85%. Comparing base (814ae78) to head (9e3511d).
⚠️ Report is 1 commits behind head on dev.

Additional details and impacted files
@@           Coverage Diff           @@
##              dev    #1408   +/-   ##
=======================================
  Coverage   92.85%   92.85%           
=======================================
  Files          41       41           
  Lines        9990     9990           
  Branches     2054     2054           
=======================================
  Hits         9276     9276           
  Misses        436      436           
  Partials      278      278           

☔ 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.

@rly
Copy link
Contributor

rly commented Mar 2, 2026

Raises the dependency lower bounds for h5py, numpy, and pandas to versions that are installable on Python >=3.12

pip and uv should be able to handle this though, right?

I propose a slightly different solution. test-min-deps is used only in CI, and the dependencies are derived from the main dependencies - just pinned. uv is currently the only package manager that supports resolving dependencies with the lowest version pinned via their --resolution lowest flag. Let's use uv in CI for this specific case and remove test-min-deps from pyproject.toml. tox.ini would then have:

install_command =
      minimum: uv pip install --resolution lowest {opts} {packages}
      upgraded: python -I -m pip install -U {opts} {packages}
      ...

What do you think @h-mayorquin ?

@h-mayorquin
Copy link
Contributor Author

Raises the dependency lower bounds for h5py, numpy, and pandas to versions that are installable on Python >=3.12

pip and uv should be able to handle this though, right?

I propose a slightly different solution. test-min-deps is used only in CI, and the dependencies are derived from the main dependencies - just pinned. uv is currently the only package manager that supports resolving dependencies with the lowest version pinned via their --resolution lowest flag. Let's use uv in CI for this specific case and remove test-min-deps from pyproject.toml. tox.ini would then have:

install_command =
      minimum: uv pip install --resolution lowest {opts} {packages}
      upgraded: python -I -m pip install -U {opts} {packages}
      ...

What do you think @h-mayorquin ?

I think this makes more sense. See the latest changes for my version of this to see if this is what you envisioned.

@rly
Copy link
Contributor

rly commented Mar 2, 2026

Yes, exactly! Can you update the tox.ini to get uv to work?

@rly rly enabled auto-merge (squash) March 2, 2026 19:38
…encies_uv_compatible' into make_project_dependencies_uv_compatible
@h-mayorquin
Copy link
Contributor Author

Yes, exactly! Can you update the tox.ini to get uv to work?

Ok, check the last commit.

@rly
Copy link
Contributor

rly commented Mar 2, 2026

Thanks. I was exploring a solution to the last failing issue as well. Since there are only two "minimum" environments, I worry that the !minimum negation approach (which is clever) is hard to understand and clutters the main testenv env definition. Let me push a small refactor.

Replace factor negation (!minimum) in base [testenv] with explicit
[testenv:pytest-py310-minimum] and [testenv:gallery-py310-minimum]
sections. This is easier to read — all minimum env config is in one
place — and avoids the pip --group flag (requires pip 24.3+).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@rly
Copy link
Contributor

rly commented Mar 2, 2026

It's a little redundant, but explicit and hopefully easier to understand for this use case. @h-mayorquin, let me know what you think.

@h-mayorquin
Copy link
Contributor Author

It's a little redundant, but explicit and hopefully easier to understand for this use case. @h-mayorquin, let me know what you think.

I think this is better, more surgical. Restrict the special configuration to that environment might be more verbose but is more decoupled.

@rly rly merged commit a27f606 into dev Mar 2, 2026
28 checks passed
@rly rly deleted the make_project_dependencies_uv_compatible branch March 2, 2026 21:11
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