From 9094d68174932ed9ae58e32ed49c071cc11eb176 Mon Sep 17 00:00:00 2001
From: Charlie Marsh <charlie.r.marsh@gmail.com>
Date: Tue, 29 Oct 2024 17:21:04 -0400
Subject: [PATCH] Clarify relationship between specifiers and requires-python
 range

---
 crates/uv-resolver/src/requires_python.rs | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/crates/uv-resolver/src/requires_python.rs b/crates/uv-resolver/src/requires_python.rs
index f671b8ae22c6..271c61944915 100644
--- a/crates/uv-resolver/src/requires_python.rs
+++ b/crates/uv-resolver/src/requires_python.rs
@@ -25,10 +25,16 @@ pub struct RequiresPython {
     /// The supported Python versions as provides by the user, usually through the `requires-python`
     /// field in `pyproject.toml`.
     ///
-    /// For a workspace, it's the intersection of all `requires-python` values in the workspace. If no
-    /// bound was provided by the user, it's greater equal the current Python version.
+    /// For a workspace, it's the intersection of all `requires-python` values in the workspace. If
+    /// no bound was provided by the user, it's greater equal the current Python version.
+    ///
+    /// The specifiers remain static over the lifetime of the workspace, such that they
+    /// represent the initial Python version constraints.
     specifiers: VersionSpecifiers,
     /// The lower and upper bounds of the given specifiers.
+    ///
+    /// The range may be narrowed over the course of dependency resolution as the resolver
+    /// investigates environments with stricter Python version constraints.
     range: RequiresPythonRange,
 }
 
@@ -114,6 +120,8 @@ impl RequiresPython {
         } else {
             None
         };
+        // TODO(charlie): Consider re-computing the specifiers (or removing them entirely in favor
+        // of tracking the range). After narrowing, the specifiers and range may be out of sync.
         match (lower, upper) {
             (Some(lower), Some(upper)) => Some(Self {
                 specifiers: self.specifiers.clone(),