Add Requires-Python upper bound behavior to the docs (#10964)

## Summary

Closes https://github.com/astral-sh/uv/issues/10376.
This commit is contained in:
Charlie Marsh
2025-01-28 12:17:34 -05:00
committed by GitHub
parent 92b72c62ea
commit 566f0d0abd
2 changed files with 10 additions and 1 deletions
+4 -1
View File
@@ -112,7 +112,10 @@ version of a dependency requires Python 3.9 or later, while all prior versions s
versions for users running Python 3.8.
When evaluating `requires-python` ranges for dependencies, uv only considers lower bounds and
ignores upper bounds entirely. For example, `>=3.8, <4` is treated as `>=3.8`.
ignores upper bounds entirely. For example, `>=3.8, <4` is treated as `>=3.8`. Respecting upper
bounds on `requires-python` often leads to formally correct but practically incorrect resolutions,
as, e.g., resolvers will backtrack to the first published version that omits the upper bound (see:
[`Requires-Python` upper limits](https://discuss.python.org/t/requires-python-upper-limits/12663)).
## Platform-specific resolution
+6
View File
@@ -449,6 +449,12 @@ will include all index URLs when `--emit-index-url` is passed, including the def
## `requires-python` enforcement
When evaluating `requires-python` ranges for dependencies, uv only considers lower bounds and
ignores upper bounds entirely. For example, `>=3.8, <4` is treated as `>=3.8`. Respecting upper
bounds on `requires-python` often leads to formally correct but practically incorrect resolutions,
as, e.g., resolvers will backtrack to the first published version that omits the upper bound (see:
[`Requires-Python` upper limits](https://discuss.python.org/t/requires-python-upper-limits/12663)).
When evaluating Python versions against `requires-python` specifiers, uv truncates the candidate
version to the major, minor, and patch components, ignoring (e.g.) pre-release and post-release
identifiers.