From 6aa6916879819e40aa7c953cc4b917a408e0a256 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Tue, 1 Jul 2025 02:04:24 +0000 Subject: [PATCH 1/3] Update most test/lint dependencies --- .pre-commit-config.yaml | 4 ++-- requirements-tests.txt | 12 ++++++------ 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 133c3c6fcdd2..ec063fb8240a 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -11,7 +11,7 @@ repos: args: [--fix=lf] - id: check-case-conflict - repo: https://github.com/astral-sh/ruff-pre-commit - rev: v0.11.4 # must match requirements-tests.txt + rev: v0.12.1 # must match requirements-tests.txt hooks: - id: ruff name: Run ruff on stubs, tests and scripts @@ -31,7 +31,7 @@ repos: hooks: - id: black - repo: https://github.com/pycqa/flake8 - rev: 7.2.0 + rev: 7.3.0 hooks: - id: flake8 language: python diff --git a/requirements-tests.txt b/requirements-tests.txt index 33ec06e6fd8c..794605e19f12 100644 --- a/requirements-tests.txt +++ b/requirements-tests.txt @@ -1,6 +1,6 @@ # Type checkers that we test our stubs against. These should always # be pinned to a specific version to make failure reproducible. -mypy==1.16.0 +mypy==1.16.1 pyright==1.1.400 # pytype can be installed on Windows, but requires building wheels, let's not do that on the CI pytype==2024.10.11; platform_system != "Windows" and python_version >= "3.10" and python_version < "3.13" @@ -8,23 +8,23 @@ pytype==2024.10.11; platform_system != "Windows" and python_version >= "3.10" an # Libraries used by our various scripts. # TODO (2025-05-09): Installing this on Python 3.14 on Windows fails at # the moment. -aiohttp==3.11.15; python_version < "3.14" +aiohttp==3.12.13; python_version < "3.14" # TODO (2025-05-09): No wheels exist for Python 3.14 yet, slowing down CI # considerably and prone to fail. grpcio-tools>=1.66.2; python_version < "3.14" # For grpc_tools.protoc mypy-protobuf==3.6.0 -packaging==24.2 +packaging==25.0 pathspec>=0.11.1 pre-commit # Required by create_baseline_stubs.py. Must match .pre-commit-config.yaml. -ruff==0.11.4 +ruff==0.12.1 # TODO (2025-05-07): Dependency libcst doesn't support Python 3.14 yet. stubdefaulter==0.1.0; python_version < "3.14" termcolor>=2.3 tomli==2.2.1 -tomlkit==0.13.2 +tomlkit==0.13.3 typing_extensions>=4.14.0rc1 -uv==0.7.4 +uv==0.7.17 # Utilities for typeshed infrastructure scripts. ts_utils @ file:lib From b3bb2572da5484940b807f5aee6acc599cd027f7 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Tue, 1 Jul 2025 02:06:13 +0000 Subject: [PATCH 2/3] [pre-commit.ci] auto fixes from pre-commit.com hooks --- stdlib/asyncio/__init__.pyi | 2 +- stdlib/typing.pyi | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/stdlib/asyncio/__init__.pyi b/stdlib/asyncio/__init__.pyi index 68e44a88face..58739816a67e 100644 --- a/stdlib/asyncio/__init__.pyi +++ b/stdlib/asyncio/__init__.pyi @@ -1,4 +1,4 @@ -# ruff: noqa: PLR5501 # This condition is so big, it's clearer to keep to platform condition in two blocks +# This condition is so big, it's clearer to keep to platform condition in two blocks # Can't NOQA on a specific line: https://github.com/plinss/flake8-noqa/issues/22 import sys from collections.abc import Awaitable, Coroutine, Generator diff --git a/stdlib/typing.pyi b/stdlib/typing.pyi index 79ab9eee924f..b1c93dfe74d5 100644 --- a/stdlib/typing.pyi +++ b/stdlib/typing.pyi @@ -1,5 +1,4 @@ # Since this module defines "overload" it is not recognized by Ruff as typing.overload -# ruff: noqa: F811 # TODO: The collections import is required, otherwise mypy crashes. # https://github.com/python/mypy/issues/16744 import collections # noqa: F401 # pyright: ignore[reportUnusedImport] From 4f56974e47550f10b5a330664bf0dd266ed3d8f4 Mon Sep 17 00:00:00 2001 From: Alex Waygood Date: Tue, 1 Jul 2025 10:41:22 +0100 Subject: [PATCH 3/3] fixes --- .pre-commit-config.yaml | 2 +- pyproject.toml | 2 ++ tests/pyright_test.py | 2 +- 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index ec063fb8240a..de927ebff374 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -31,7 +31,7 @@ repos: hooks: - id: black - repo: https://github.com/pycqa/flake8 - rev: 7.3.0 + rev: 7.2.0 hooks: - id: flake8 language: python diff --git a/pyproject.toml b/pyproject.toml index b4a430f7510c..322a383e8d9e 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -159,6 +159,8 @@ ignore = [ # Used for direct, non-subclass type comparison, for example: `type(val) is str` # see https://github.com/astral-sh/ruff/issues/6465 "E721", # Do not compare types, use `isinstance()` + # Highly opinionated, and it's often necessary to violate it + "PLC0415", # `import` should be at the top-level of a file # Leave the size and complexity of tests to human interpretation "PLR09", # Too many ... # Too many magic number "2" that are preferable inline. https://github.com/astral-sh/ruff/issues/10009 diff --git a/tests/pyright_test.py b/tests/pyright_test.py index 04b3df6fa99e..c97ca44feb47 100755 --- a/tests/pyright_test.py +++ b/tests/pyright_test.py @@ -37,7 +37,7 @@ def main() -> None: # version installed into the virtual environment, due to failures on some # platforms. https://github.com/python/typeshed/issues/11614 os.environ["PYRIGHT_PYTHON_FORCE_VERSION"] = pyright_version - command = [npx, f"pyright@{pyright_version}"] + sys.argv[1:] + command = [npx, f"pyright@{pyright_version}", *sys.argv[1:]] print_command(command) ret = subprocess.run(command, check=False).returncode