Skip to content

fix: improve python version specifier handling in pypi.rs#5211

Merged
ruben-arts merged 3 commits intoprefix-dev:mainfrom
ruben-arts:fix/requires-python-major-minor
Jan 2, 2026
Merged

fix: improve python version specifier handling in pypi.rs#5211
ruben-arts merged 3 commits intoprefix-dev:mainfrom
ruben-arts:fix/requires-python-major-minor

Conversation

@ruben-arts
Copy link
Contributor

Description

Pixi has to create a requires-python value for the pypi solve. It bases that on the Python record from the conda solve.

We normally transfrom python-3.12.4 into requires-python = ">=3.12" But this doesn't work in the uv solve when it also checks the actually requires-python in the pyproject.toml and it doesn't match. e.g. in the case of issue #5202. Where ==3.10.6 doesn't satisfy >=3.10.*. This is all happening somewhere in the UV code. I checked what uv does with that information and it seems to use the installed python version directly. So change in this PR should do the same.

What would be a better fix is to actually get the information from the requires_python spec. This would be more correct. But I don't see a nice way to transfer that information to this solving function.

Fixes #5205

Draft because I don't trust the fix yet, @tdejager could you take a critical look?

How Has This Been Tested?

I've tested the issue and tried to break the wheel fetching that is described in the comment above the removed code.

Checklist:

  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • I have added sufficient tests to cover my changes.

@ruben-arts ruben-arts requested a review from tdejager December 29, 2025 10:09
@lucascolley lucascolley added bug Something isn't working pypi Issue related to PyPI dependencies pyproject uv Related to the uv integration and removed pyproject labels Dec 31, 2025
@tdejager
Copy link
Contributor

tdejager commented Jan 2, 2026

I think looking at this change and the issue, that this is the intended way I wanted to set the version. So if this works, we should give it a go.

@ruben-arts
Copy link
Contributor Author

I've been testing this some more with actually creating a interpreter specific wheel and depending on that.

[pypi-dependencies]
minimal-project = { path = "minimal-project/dist/minimal_project-0.1-cp314-cp314-macosx_15_0_arm64.whl" }

And that works with this implementation to take that package.

And the old code originally fixed an issue with #2481 which still works with this change.

Copy link
Contributor

tdejager commented Jan 2, 2026

Should we take it out of draft and merge?

@ruben-arts
Copy link
Contributor Author

I've added a more specific test to test the functionallity.

@ruben-arts ruben-arts marked this pull request as ready for review January 2, 2026 13:46
@ruben-arts ruben-arts enabled auto-merge (squash) January 2, 2026 13:47
@ruben-arts
Copy link
Contributor Author

@tdejager I've enabled auto merge, if you could take another look and approve it github will take over.

@ruben-arts ruben-arts merged commit 8e92ef8 into prefix-dev:main Jan 2, 2026
37 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working pypi Issue related to PyPI dependencies uv Related to the uv integration

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Specifying a python sub-version causes dependency resolution to fail

3 participants