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

[Bug]: Dependency Resolution Failure when Upper Bound on Required Python Version #8297

Closed
mahyarmirrashed opened this issue Oct 17, 2024 · 1 comment · Fixed by #8403
Closed
Assignees
Labels
bug Something isn't working

Comments

@mahyarmirrashed
Copy link

I noticed this error about a week ago when I switched over from poetry to uv. The dependency resolution fails when I set the upper bound of the required version in my pyproject.toml. (Yes, apparently this is a contentious decision, but I think I'll keep it.)

[project]
name = "test"
version = "0.0.0"
requires-python = ">=3.6,<4.0"
dependencies = []

[project.optional-dependencies]
dev = [
  "basedpyright>=1.17.0,<1.18.0; python_version>='3.8'",
  "pytest>=8.3.0,<8.4.0; python_version>='3.8'",
  "boto3-stubs[ecr,s3]>=1.35.0,<1.36.0; python_version>='3.8'",
  "types-paho-mqtt>=1.6.0,<1.7.0; python_version>='3.8'",
]

That TOML should give you what is needed to reproduce the error. Your local Python version shouldn't matter in reproducing this bug.

To fix it, removing <4.0 does allow uv to resolve the dependencies based on the local Python version, as expected.

@charliermarsh charliermarsh self-assigned this Oct 17, 2024
@charliermarsh charliermarsh added the bug Something isn't working label Oct 17, 2024
charliermarsh added a commit that referenced this issue Oct 21, 2024
## Summary

If the user has an upper-bound in a `requires-python`, we don't
correctly narrow it during resolution. We should be narrowing based on
the intersection.

Closes #8297.
@mahyarmirrashed
Copy link
Author

❤️

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants