diff --git a/crates/uv-build/ruff.toml b/crates/uv-build/ruff.toml new file mode 100644 index 000000000..e480507a2 --- /dev/null +++ b/crates/uv-build/ruff.toml @@ -0,0 +1,2 @@ +# It is important retain compatibility with old versions in the build backend +target-version = "py37" diff --git a/crates/uv-python/fetch-download-metadata.py b/crates/uv-python/fetch-download-metadata.py index 0b5d9caec..08adaecea 100755 --- a/crates/uv-python/fetch-download-metadata.py +++ b/crates/uv-python/fetch-download-metadata.py @@ -630,7 +630,9 @@ class GraalPyFinder(Finder): for download in batch: url = download.url + ".sha256" checksum_requests.append(self.client.get(url)) - for download, resp in zip(batch, await asyncio.gather(*checksum_requests)): + for download, resp in zip( + batch, await asyncio.gather(*checksum_requests), strict=False + ): try: resp.raise_for_status() except httpx.HTTPStatusError as e: diff --git a/crates/uv-python/python/get_interpreter_info.py b/crates/uv-python/python/get_interpreter_info.py index 0fe088819..8e9fc37fd 100644 --- a/crates/uv-python/python/get_interpreter_info.py +++ b/crates/uv-python/python/get_interpreter_info.py @@ -39,10 +39,9 @@ if hasattr(sys, "implementation"): # GraalPy reports the CPython version as sys.implementation.version, # so we need to discover the GraalPy version from the cache_tag import re + implementation_version = re.sub( - r"graalpy(\d)(\d+)-\d+", - r"\1.\2", - sys.implementation.cache_tag + r"graalpy(\d)(\d+)-\d+", r"\1.\2", sys.implementation.cache_tag ) else: implementation_version = format_full_version(sys.implementation.version) @@ -583,7 +582,6 @@ def main() -> None: elif os_and_arch["os"]["name"] == "musllinux": manylinux_compatible = True - # By default, pip uses sysconfig on Python 3.10+. # But Python distributors can override this decision by setting: # sysconfig._PIP_USE_SYSCONFIG = True / False @@ -608,7 +606,7 @@ def main() -> None: except (ImportError, AttributeError): pass - import distutils.dist + import distutils.dist # noqa: F401 except ImportError: # We require distutils, but it's not installed; this is fairly # common in, e.g., deadsnakes where distutils is packaged @@ -641,7 +639,10 @@ def main() -> None: # Prior to the introduction of `sysconfig` patching, python-build-standalone installations would always use # "/install" as the prefix. With `sysconfig` patching, we rewrite the prefix to match the actual installation # location. So in newer versions, we also write a dedicated flag to indicate standalone builds. - "standalone": sysconfig.get_config_var("prefix") == "/install" or bool(sysconfig.get_config_var("PYTHON_BUILD_STANDALONE")), + "standalone": ( + sysconfig.get_config_var("prefix") == "/install" + or bool(sysconfig.get_config_var("PYTHON_BUILD_STANDALONE")) + ), "scheme": get_scheme(use_sysconfig_scheme), "virtualenv": get_virtualenv(), "platform": os_and_arch, diff --git a/crates/uv-python/python/packaging/_elffile.py b/crates/uv-python/python/packaging/_elffile.py index f7a02180b..8dc7fb32a 100644 --- a/crates/uv-python/python/packaging/_elffile.py +++ b/crates/uv-python/python/packaging/_elffile.py @@ -69,8 +69,7 @@ class ELFFile: }[(self.capacity, self.encoding)] except KeyError: raise ELFInvalid( - f"unrecognized capacity ({self.capacity}) or " - f"encoding ({self.encoding})" + f"unrecognized capacity ({self.capacity}) or encoding ({self.encoding})" ) try: diff --git a/crates/uv-python/python/packaging/_manylinux.py b/crates/uv-python/python/packaging/_manylinux.py index a0e8846e7..7b52a5581 100644 --- a/crates/uv-python/python/packaging/_manylinux.py +++ b/crates/uv-python/python/packaging/_manylinux.py @@ -161,8 +161,7 @@ def _parse_glibc_version(version_str: str) -> _GLibCVersion: m = re.match(r"(?P[0-9]+)\.(?P[0-9]+)", version_str) if not m: warnings.warn( - f"Expected glibc version with 2 components major.minor," - f" got: {version_str}", + f"Expected glibc version with 2 components major.minor, got: {version_str}", RuntimeWarning, ) return _GLibCVersion(-1, -1) diff --git a/crates/uv-python/python/ruff.toml b/crates/uv-python/python/ruff.toml new file mode 100644 index 000000000..5e6921be4 --- /dev/null +++ b/crates/uv-python/python/ruff.toml @@ -0,0 +1,2 @@ +# It is important retain compatibility when querying interpreters +target-version = "py37" diff --git a/ruff.toml b/ruff.toml index 8aac77263..7c6488a1e 100644 --- a/ruff.toml +++ b/ruff.toml @@ -1,10 +1,10 @@ -target-version = "py37" +target-version = "py312" exclude = [ "crates/uv-virtualenv/src/activator/activate_this.py", "crates/uv-virtualenv/src/_virtualenv.py", - "crates/uv-python/python", "ecosystem", "scripts/workspaces", + "scripts/packages", ] [lint] diff --git a/scripts/transform_readme.py b/scripts/transform_readme.py index b8f11fbe0..9d52d6517 100644 --- a/scripts/transform_readme.py +++ b/scripts/transform_readme.py @@ -9,11 +9,10 @@ from __future__ import annotations import argparse import re +import tomllib import urllib.parse from pathlib import Path -import tomllib - # To be kept in sync with: `docs/index.md` URL = "https://github.com/astral-sh/uv/assets/1309177/{}" URL_LIGHT = URL.format("629e59c0-9c6e-4013-9ad4-adb2bcf5080d") diff --git a/scripts/workspaces/albatross-in-example/src/albatross/__init__.py b/scripts/workspaces/albatross-in-example/src/albatross/__init__.py index d79aed9cb..764c5ce3f 100644 --- a/scripts/workspaces/albatross-in-example/src/albatross/__init__.py +++ b/scripts/workspaces/albatross-in-example/src/albatross/__init__.py @@ -5,5 +5,5 @@ def fly(): pass -if __name__ == '__main__': +if __name__ == "__main__": print("Caw")