-
Notifications
You must be signed in to change notification settings - Fork 854
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
Python version limited requirement in universal locking #4668
Python version limited requirement in universal locking #4668
Comments
Oh thank you, I think this is the same as #4669 -- sorry, I missed that you created this. |
I'm going to merge into #4669. Good bug! |
Re-opening because this case is a little different than the NumPy one and they'll have separate PRs. |
I'm facing a related issue: using python 3.9,
pdm has a dependency on truststore |
On main there's now a workaround for this: [project]
name = "foo"
version = "0.1.0"
description = "Add your description here"
readme = "README.md"
requires-python = ">=3.7"
dependencies = ["uv ; python_version >= '3.8'"]
[build-system]
requires = ["hatchling"]
build-backend = "hatchling.build"
[tool.uv]
environments = ["python_version < '3.8'", "python_version >= '3.8'"] |
I'm encountering something similar, where the environments workaround doesn't appear to work. It works with only the [project]
name = "foo"
version = "0.0.0"
description = ""
requires-python = ">=3.8,<4"
dependencies = [
"pydantic",
"numpy >= 2.0; python_version >= '3.9'",
]
[tool.uv]
environments = ["python_version < '3.9'", "python_version >= '3.9'"] This ^ will attempt to install numpy (which then fails for me), which i think it shouldnt even be attempting. I'm not sure what significance |
Can you clarify what the issue is? It's attempting to install NumPy on which Python versions? (I can |
oh right sorry! admittedly the failing part is because it's trying to build the wheel and i dont have the requirements necessary, but the point is that it's installing numpy when it shouldn't anyway. |
It looks like the workaround suggested here does not work anymore on 0.4.1, with the changes made in #6841: $ uv lock
error: Environment markers `python_full_version >= '3.8'` don't overlap with Python requirement `>=3.7` Since the workaround was suggested a few weeks ago, is there maybe a better way to work around the issue now? |
If that's not working, it looks like a bug. Let me take a look. |
Apologies @mkniewallner, really dumb bug: #6902 |
Fwiw, if anyone else runs into #4668 (comment) (because it was blocking by ability to adopt uv), a newer release of uv (0.4.20), given the referenced pyproject.toml, produces
I took that to imply that I need to match the upper bound with the upper bound of my project: |
…#43227) Just having the python_version requirement doesn't seem to correctly make uv "fork" the resolver path (Charlie's words/terms), so we either need to specify both module versions here. The other option that could work is putting this in our pyproject.toml ``` [tool.uv] environments = ["python_version >= '3.10'", "python_version < '3.10'"] ``` But having both versions specified keeps the fix localized into the provider so I have chosen this approach. This is likely why the exclued-python-version setting we already had wasn't working for uv sync. astral-sh/uv#4668
…apache#43227) Just having the python_version requirement doesn't seem to correctly make uv "fork" the resolver path (Charlie's words/terms), so we either need to specify both module versions here. The other option that could work is putting this in our pyproject.toml ``` [tool.uv] environments = ["python_version >= '3.10'", "python_version < '3.10'"] ``` But having both versions specified keeps the fix localized into the provider so I have chosen this approach. This is likely why the exclued-python-version setting we already had wasn't working for uv sync. astral-sh/uv#4668
…apache#43227) Just having the python_version requirement doesn't seem to correctly make uv "fork" the resolver path (Charlie's words/terms), so we either need to specify both module versions here. The other option that could work is putting this in our pyproject.toml ``` [tool.uv] environments = ["python_version >= '3.10'", "python_version < '3.10'"] ``` But having both versions specified keeps the fix localized into the provider so I have chosen this approach. This is likely why the exclued-python-version setting we already had wasn't working for uv sync. astral-sh/uv#4668
This should "just work" without any workarounds in the next version (see: #8628). |
Cool . We are getting way closer now with |
…apache#43227) Just having the python_version requirement doesn't seem to correctly make uv "fork" the resolver path (Charlie's words/terms), so we either need to specify both module versions here. The other option that could work is putting this in our pyproject.toml ``` [tool.uv] environments = ["python_version >= '3.10'", "python_version < '3.10'"] ``` But having both versions specified keeps the fix localized into the provider so I have chosen this approach. This is likely why the exclued-python-version setting we already had wasn't working for uv sync. astral-sh/uv#4668
With uv 0.2.18 the following fails
Which on one hand makes sense, as there really is no version of uv supporting Python 3.7. On the other hand,
uv==X; python_version>="3.8"
could be installed under Python 3.7 for any version X.In non-universal locking,
uv;python_version>="3.8"
can be compiled for Python 3.7:The text was updated successfully, but these errors were encountered: