1919 (Version ("3.11" ), Version ("1.25" )),
2020 (Version ("3.12" ), Version ("1.26" )),
2121 (Version ("3.13" ), Version ("2.1" )),
22- ) # fmt: skip
22+ )
2323
2424
2525class UVPythonVersionParts (TypedDict ):
@@ -81,7 +81,9 @@ def get_package_minimum_python_version(package: str) -> Version:
8181 """
8282 raw_version = importlib .metadata .metadata (package )["Requires-Python" ]
8383 if "<" in raw_version :
84- raise NotImplementedError ("Version specifier with upper bound not yet supported!" )
84+ raise NotImplementedError (
85+ "Version specifier with upper bound not yet supported!"
86+ )
8587
8688 return parse (raw_version .replace (">=" , "" ).replace ("~=" , "" ))
8789
@@ -98,7 +100,8 @@ def get_dependency_minimum_version(package: str, dependency: str) -> Version:
98100 Version: The minimum required version of the dependency.
99101
100102 Raises:
101- ValueError: If the package does not list any requirements or the dependency is not found.
103+ ValueError:
104+ The package does not list any requirements or the dependency is not found.
102105
103106 """
104107 requirements = importlib .metadata .requires (package )
@@ -107,33 +110,49 @@ def get_dependency_minimum_version(package: str, dependency: str) -> Version:
107110
108111 try :
109112 # Find the first requirement that matches the dependency and is not an extra
110- dependency_req = next (req for req in requirements if req .startswith (dependency ) and " extra " not in req )
113+ dependency_req = next (
114+ req
115+ for req in requirements
116+ if req .startswith (dependency ) and " extra " not in req
117+ )
111118 except StopIteration as e :
112- raise ValueError (f"Dependency { dependency } not found in requirements for { package } " ) from e
119+ raise ValueError (
120+ f"Dependency { dependency } not found in requirements for { package } "
121+ ) from e
113122
114123 # Extract the version specifier (e.g., ">=1.21.0")
115- version_specifier = next ((ver for ver in dependency_req .split ("," ) if ">" in ver ), None )
124+ version_specifier = next (
125+ (ver for ver in dependency_req .split ("," ) if ">" in ver ), None
126+ )
116127 if version_specifier is None :
117- raise ValueError (f"No version specifier found for dependency { dependency } in { package } " )
128+ raise ValueError (
129+ f"No version specifier found for dependency { dependency } in { package } "
130+ )
118131
119132 # Remove dependency name and comparison operator to get the version
120- version_str = version_specifier .replace (dependency , "" ).replace (">=" , "" ).replace (">" , "" )
133+ version_str = (
134+ version_specifier .replace (dependency , "" ).replace (">=" , "" ).replace (">" , "" )
135+ )
121136 return parse (version_str )
122137
123138
124139def get_available_python_versions (
125- min_version : Version | None = None , max_version : Version | None = None , pre_releases : bool = False
140+ min_version : Version | None = None ,
141+ max_version : Version | None = None ,
142+ pre_releases : bool = False ,
126143) -> list [Version ]:
127144 """
128- Get a list of available Python versions from GitHub Actions' Python Versions Manifest.
145+ Get a list of available Python versions from GitHub Actions' Python Versions
146+ Manifest.
129147
130148 Args:
131149 min_version (Version | None): The minimum Python version to include in the list.
132150 max_version (Version | None): The maximum Python version to include in the list.
133151 pre_releases (bool): Whether to include pre-release versions.
134152
135153 Returns:
136- list[Version]: A list of available Python versions satisfying the specified criteria.
154+ list[Version]:
155+ A list of available Python versions satisfying the specified criteria.
137156
138157 Raises:
139158 urllib.error.URLError: If fetching data fails.
@@ -189,19 +208,22 @@ def fetch_json(url: str) -> Any:
189208 sys .exit (1 )
190209
191210
192- def get_available_package_versions (package_name : str , min_version : Version , pre_releases : bool = False ) -> dict [Version , str ]:
211+ def get_available_package_versions (
212+ package_name : str , min_version : Version , pre_releases : bool = False
213+ ) -> dict [Version , str ]:
193214 """
194- Get available package versions from PyPI starting from the specified minimum version,
195- but only include the latest micro version within each minor version series,
215+ Get available package versions from PyPI starting from the specified minimum
216+ version, but only include the latest micro version within each minor version series,
196217 along with their 'requires_python' specifiers.
197218
198219 Args:
199220 package_name (str): The name of the package on PyPI.
200221 min_version (Version): The minimum version to include.
201222
202223 Returns:
203- dict[Version, str]: A mapping from the latest package versions in each minor version
204- series to their 'requires_python' specifier.
224+ dict[Version, str]:
225+ A mapping from the latest package versions in each minor version series to
226+ their 'requires_python' specifier.
205227
206228 Raises:
207229 RuntimeError: If no 'requires_python' is found for a package version.
@@ -268,7 +290,10 @@ def main() -> None:
268290 continue
269291
270292 # Skip incompatible combinations
271- if any (py_version >= py_min and np_version < np_min for py_min , np_min in MIN_VERSIONS ):
293+ if any (
294+ py_version >= py_min and np_version < np_min
295+ for py_min , np_min in MIN_VERSIONS
296+ ):
272297 continue
273298
274299 matrix_entries .append ({
0 commit comments