From a5f1694a2066c304bbec445e0ed908125f8248b0 Mon Sep 17 00:00:00 2001 From: Daniel Sperber Date: Fri, 14 Mar 2025 12:31:09 +0100 Subject: [PATCH 1/6] Upgrade ruff to 0.10.0 --- pyproject.toml | 1 + test-requirements.txt | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index b0046a7b..69afd935 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -95,6 +95,7 @@ ignore = [ "RUF012", "RUF022", "RUF023", + "RUF041", ] [tool.ruff.lint.per-file-ignores] diff --git a/test-requirements.txt b/test-requirements.txt index 4b0fc81e..724da3ec 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -1 +1 @@ -ruff==0.9.6 +ruff==0.10.0 From 901893647f952f03878d140fc23d7f94d4092175 Mon Sep 17 00:00:00 2001 From: Daniel Sperber Date: Wed, 26 Mar 2025 11:07:03 +0100 Subject: [PATCH 2/6] Prefer not to use 0.10 --- test-requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test-requirements.txt b/test-requirements.txt index 724da3ec..31379a8f 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -1 +1 @@ -ruff==0.10.0 +ruff==0.11.2 From c615c2efe2e94af28027e91ef7f553b0386b36f9 Mon Sep 17 00:00:00 2001 From: Daniel Sperber Date: Tue, 8 Jul 2025 10:18:54 +0200 Subject: [PATCH 3/6] Upgrade ruff --- .pre-commit-config.yaml | 2 +- pyproject.toml | 13 ++++++++----- src/_typed_dict_test_helper.py | 2 +- 3 files changed, 10 insertions(+), 7 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 9984bf0f..26dfa9a7 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,6 +1,6 @@ repos: - repo: https://github.com/astral-sh/ruff-pre-commit - rev: v0.9.6 + rev: v0.12.2 hooks: - id: ruff args: [--fix, --exit-non-zero-on-fix] diff --git a/pyproject.toml b/pyproject.toml index 31ed9c47..ae629912 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -91,11 +91,14 @@ ignore = [ "UP019", "UP035", "UP038", - # Not relevant here - "RUF012", - "RUF022", - "RUF023", - "RUF041", + # Not relevant here, or harmful for tests if applied. + "RUF012", # Use ClassVar for mutables + "RUF022", # Unsorted __all__ + "RUF023", # Unsorted __slots__ + "RUF031", # parentheses for tuples in subscripts + "RUF041", # nested Literal + "RUF036", # None not at end of Union + "B903", # Use dataclass / namedtuple # Ruff doesn't understand the globals() assignment; we test __all__ # directly in test_all_names_in___all__. "F822", diff --git a/src/_typed_dict_test_helper.py b/src/_typed_dict_test_helper.py index 73cf9199..3c51a79d 100644 --- a/src/_typed_dict_test_helper.py +++ b/src/_typed_dict_test_helper.py @@ -16,7 +16,7 @@ class Foo(TypedDict): class FooGeneric(TypedDict, Generic[T]): - a: Optional[T] + a: Optional[T] # noqa: UP045 while < (3, 10) class VeryAnnotated(TypedDict, total=False): From 6b726194fe8206dbd012e37343adca1f0cbf3244 Mon Sep 17 00:00:00 2001 From: Daniel Sperber Date: Tue, 8 Jul 2025 10:18:54 +0200 Subject: [PATCH 4/6] Upgrade ruff to 0.12.2 --- .pre-commit-config.yaml | 2 +- pyproject.toml | 13 ++++++++----- src/_typed_dict_test_helper.py | 2 +- 3 files changed, 10 insertions(+), 7 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 9984bf0f..26dfa9a7 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,6 +1,6 @@ repos: - repo: https://github.com/astral-sh/ruff-pre-commit - rev: v0.9.6 + rev: v0.12.2 hooks: - id: ruff args: [--fix, --exit-non-zero-on-fix] diff --git a/pyproject.toml b/pyproject.toml index 31ed9c47..0e50b144 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -91,11 +91,14 @@ ignore = [ "UP019", "UP035", "UP038", - # Not relevant here - "RUF012", - "RUF022", - "RUF023", - "RUF041", + # Not relevant here, or harmful for tests if applied. + "RUF012", # Use ClassVar for mutables + "RUF022", # Unsorted __all__ + "RUF023", # Unsorted __slots__ + "RUF031", # parentheses for tuples in subscripts + "RUF036", # None not at end of Union + "RUF041", # nested Literal + "B903", # Use dataclass / namedtuple # Ruff doesn't understand the globals() assignment; we test __all__ # directly in test_all_names_in___all__. "F822", diff --git a/src/_typed_dict_test_helper.py b/src/_typed_dict_test_helper.py index 73cf9199..3c51a79d 100644 --- a/src/_typed_dict_test_helper.py +++ b/src/_typed_dict_test_helper.py @@ -16,7 +16,7 @@ class Foo(TypedDict): class FooGeneric(TypedDict, Generic[T]): - a: Optional[T] + a: Optional[T] # noqa: UP045 while < (3, 10) class VeryAnnotated(TypedDict, total=False): From 6c9eeec6f85f9ff97299b436d743ee35f5a25035 Mon Sep 17 00:00:00 2001 From: Daniel Sperber Date: Tue, 8 Jul 2025 12:59:59 +0200 Subject: [PATCH 5/6] Feedback: Disable autofix, per-file-ignores --- .pre-commit-config.yaml | 1 - pyproject.toml | 12 ++++++++---- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 26dfa9a7..7b4d4a87 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -3,7 +3,6 @@ repos: rev: v0.12.2 hooks: - id: ruff - args: [--fix, --exit-non-zero-on-fix] - repo: https://github.com/pre-commit/pre-commit-hooks rev: v4.5.0 hooks: diff --git a/pyproject.toml b/pyproject.toml index 0e50b144..c8897df2 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -91,13 +91,11 @@ ignore = [ "UP019", "UP035", "UP038", - # Not relevant here, or harmful for tests if applied. + "UP045", # X | None instead of Optional[X] + # Not relevant here "RUF012", # Use ClassVar for mutables "RUF022", # Unsorted __all__ "RUF023", # Unsorted __slots__ - "RUF031", # parentheses for tuples in subscripts - "RUF036", # None not at end of Union - "RUF041", # nested Literal "B903", # Use dataclass / namedtuple # Ruff doesn't understand the globals() assignment; we test __all__ # directly in test_all_names_in___all__. @@ -114,6 +112,12 @@ ignore = [ "E501", "E701", ] +"src/test_typing_extensions.py" = [ + # Harmful for tests if applied. + "RUF031", # parentheses for tuples in subscripts + "RUF036", # None not at end of Union + "RUF041", # nested Literal +] [tool.ruff.lint.isort] extra-standard-library = ["tomllib"] From 218f33c1490816b771fd64687cc3a060b9decb35 Mon Sep 17 00:00:00 2001 From: Daniel Sperber Date: Tue, 8 Jul 2025 13:31:23 +0200 Subject: [PATCH 6/6] Feedback --- pyproject.toml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index c8897df2..66528698 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -97,6 +97,7 @@ ignore = [ "RUF022", # Unsorted __all__ "RUF023", # Unsorted __slots__ "B903", # Use dataclass / namedtuple + "RUF031", # parentheses for tuples in subscripts # Ruff doesn't understand the globals() assignment; we test __all__ # directly in test_all_names_in___all__. "F822", @@ -111,10 +112,7 @@ ignore = [ "E306", "E501", "E701", -] -"src/test_typing_extensions.py" = [ # Harmful for tests if applied. - "RUF031", # parentheses for tuples in subscripts "RUF036", # None not at end of Union "RUF041", # nested Literal ]