Open pyproject.toml and update the value for requires-python:
requires-python = ">=3.8,<3.13,!=3.9.7"
Next:
uv lock
This gives an error:
Using CPython 3.12.6
error: The Python request from `.python-version` resolved to Python 3.12.6, which is incompatible with the project's Python requirement: `>=3.8, <3.9.7, >3.9.7, <3.13`. However, a workspace member (`test-requires-python`) supports Python >=3.8, !=3.9.7, <3.13. To install the workspace member on its own, navigate to ``, then run `uv venv --python 3.12.6` followed by `uv pip install -e .`.
The comma (“,”) is equivalent to a logical and operator: a candidate version must match all given version clauses in order to match the specifier as a whole.
But it seems that uv transforms >=3.8,<3.13,!=3.9.7 to >=3.8, <3.9.7, >3.9.7, <3.13, which is not what is intended. OTOH, in a different code path, uv does recognize that 3.12.6 is within the constraint of >=3.8, !=3.9.7, <3.13
Hello,
I'm having a problem specifying
requires-python
.My environment: MacOS M1 uv 0.4.16 (e81ed8ec5 2024-09-24) python 3.12.6 (pyenv)
To reproduce:
Open
pyproject.toml
and update the value forrequires-python
:Next:
This gives an error:
I would expect the version 3.12.6 to be according to the constraints. See https://packaging.python.org/en/latest/specifications/version-specifiers/#id5 which states:
But it seems that
uv
transforms>=3.8,<3.13,!=3.9.7
to>=3.8, <3.9.7, >3.9.7, <3.13
, which is not what is intended. OTOH, in a different code path,uv
does recognize that3.12.6
is within the constraint of>=3.8, !=3.9.7, <3.13
Thanks for a great tool! Wietse