-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Is uv sync
intended for developing libraries?
#8978
Comments
I think it's because UV is looking for a compatible version. If you want to use |
Therefore, if you have a dependency on Python 3.9, you can only choose to rely on versions of Django below 5.0, or have Python 3.9 and Python 3.10 rely on different versions of Django. Examples of dependencies on different versions: requires-python = ">=3.9"
dependencies = [
"SQLAlchemy>=1.4,<2",
"Django>=5.0 ; python_version >= '3.10'",
"Django<5.0 ; python_version < '3.10'"
] Edit: |
Your example would have encoded too much restriction. However, with that hint I was able to find this solution that tells the resolver that it'll need to look for multiple versions of Django depending on the Python version, without adding addition restrictions for my library's consumers.
Yes, this would be great.
Thank you for explaining that. I think I can work with this limitation of the resolver, although I'd be very happy to see this limitation lifted. I found these other issues and pull requests that seem related to this, for anyone else that stumbles across this issue and wants to see what happens: #8492, #7190, #8686 |
I'm authoring a python library package (Aldjemy), and I'm running into a problem that I think I've seen before (with Poetry) that makes me think that I'm probably not using
uv
correctly, but I'm not really sure what is and is not intended.When I do
uv sync --upgrade
, it always installs Django 4.2. If I attempt to force it to use Django 5.1.3, I get the following message:It's clear to me that this is treating the Python dependency differently from other dependencies. Instead of ensuring that my package requires 3.9+, which I'd expect to cause problems attempting to install in a lower version of Python but not a higher version, it's making sure that all my dependencies, transitively add no further restriction to my acceptable Python versions.
Right at this moment I'm not imaginative enough to figure out why someone would want this behavior, but I'm pretty sure it's not the behavior I should be wanting. Is there a better way to do what I'm trying to do? Is
uv sync
the wrong tool? (I like that it will quickly create and manage the venv for me). Is this the wrong way to specify minimum versions for libraries?The text was updated successfully, but these errors were encountered: