Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Model Python version as a PubGrub package #745

Merged
merged 5 commits into from
Jan 3, 2024
Merged

Conversation

charliermarsh
Copy link
Member

Summary

This PR modifies the resolver to treat the Python version as a package, which allows for better error messages (since we no longer treat incompatible packages as if they "don't exist at all").

There are a few tricky pieces here...

First, we need to track both the interpreter's Python version and the target Python version, because we support resolving for other versions via --python 3.7.

Second, we allow using incompatible wheels during resolution, as long as there's a compatible source distribution. So we still need to test for requires-python compatibility when selecting distributions.

This could use more testing, but it feels like an area where packse would be more productive than writing PyPI tests.

Closes #406.

@charliermarsh charliermarsh marked this pull request as draft January 2, 2024 22:37
@charliermarsh
Copy link
Member Author

This is actually harder than I thought. Consider the case of resolving NumPy with --python-version 3.8. In that case, we want to skip building all the source distributions for versions later than 1.24.4. But we want to return them to PubGrub so that they're modeled as incompatibilities and not ignored entirely. So we need some new abstraction around Candidate to indicate whether it's compatible or incompatible.

@charliermarsh
Copy link
Member Author

I think I know how to solve but will be a bit more work, so marking as draft.

@charliermarsh charliermarsh force-pushed the charlie/py-version branch 4 times, most recently from ef079c0 to dc3d37c Compare January 3, 2024 01:37
@charliermarsh charliermarsh changed the base branch from main to charlie/dep January 3, 2024 01:38
@charliermarsh charliermarsh marked this pull request as ready for review January 3, 2024 01:38
@charliermarsh
Copy link
Member Author

Okay, should be ready for review.

Base automatically changed from charlie/dep to main January 3, 2024 02:26
crates/puffin-resolver/src/finder.rs Show resolved Hide resolved
crates/puffin-resolver/src/resolver.rs Outdated Show resolved Hide resolved
@charliermarsh charliermarsh force-pushed the charlie/py-version branch 2 times, most recently from 2b5f2a7 to 5b44051 Compare January 3, 2024 15:14
@charliermarsh charliermarsh enabled auto-merge (squash) January 3, 2024 15:15
@charliermarsh charliermarsh merged commit fd556cc into main Jan 3, 2024
3 checks passed
@charliermarsh charliermarsh deleted the charlie/py-version branch January 3, 2024 15:20
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.

Treat python version as a dependency when resolving
2 participants