Skip to content

Commit 7aa4ec6

Browse files
authored
Update pre-commit hooks (#10044)
* Update pre-commit hooks * Fixed formatting
1 parent ce3dcc7 commit 7aa4ec6

4 files changed

Lines changed: 33 additions & 40 deletions

File tree

‎.pre-commit-config.yaml‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ repos:
99
- id: check-symlinks
1010
- id: check-toml
1111
- repo: https://github.com/PyCQA/isort
12-
rev: 7.0.0
12+
rev: 9.0.1
1313
hooks:
1414
- id: isort
1515
- repo: https://github.com/PyCQA/flake8
@@ -28,7 +28,7 @@ repos:
2828
- black==26.1.0
2929
- repo: https://github.com/codespell-project/codespell
3030
# Configuration for codespell is in pyproject.toml
31-
rev: v2.4.1
31+
rev: v2.4.3
3232
hooks:
3333
- id: codespell
3434
additional_dependencies:
@@ -40,10 +40,10 @@ repos:
4040
- id: pyupgrade
4141
args: ["--py310-plus", "--keep-percent-format"]
4242
- repo: https://github.com/tox-dev/pyproject-fmt
43-
rev: v2.11.1
43+
rev: v2.29.4
4444
hooks:
4545
- id: pyproject-fmt
4646
- repo: https://github.com/adamchainz/django-upgrade
47-
rev: 1.24.0
47+
rev: 1.32.0
4848
hooks:
4949
- id: django-upgrade

‎pyproject.toml‎

Lines changed: 25 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,6 @@ test = [
4848
"pytest==9.*",
4949
"pytest-cov==7.*",
5050
"pytest-django>=4.5.2,<5",
51-
5251
]
5352
docs = [
5453
# MkDocs to build our documentation.
@@ -57,6 +56,10 @@ docs = [
5756
# pylinkvalidator to check for broken links in documentation.
5857
"pylinkvalidator==0.3",
5958
]
59+
django52 = [ "django>=5.2,<6.0" ]
60+
django60 = [ "django>=6.0,<6.1" ]
61+
django61 = [ "django>=6.1,<6.2" ]
62+
djangomain = [ "django @ https://github.com/django/django/archive/main.tar.gz" ]
6063
optional = [
6164
# Optional packages which may be used with REST framework.
6265
"django-filter",
@@ -70,49 +73,39 @@ optional = [
7073
"requests",
7174
"uritemplate",
7275
]
73-
django52 = [ "django>=5.2,<6.0" ]
74-
django60 = [ "django>=6.0,<6.1" ]
75-
django61 = [ "django>=6.1,<6.2" ]
76-
djangomain = [ "django @ https://github.com/django/django/archive/main.tar.gz" ]
7776

7877
[tool.setuptools]
79-
80-
[tool.setuptools.dynamic]
81-
version = { attr = "rest_framework.__version__" }
82-
83-
[tool.setuptools.packages.find]
84-
include = [ "rest_framework*" ]
85-
86-
[tool.setuptools.package-data]
87-
"rest_framework" = [
88-
"templates/**/*",
89-
"static/**/*",
78+
packages.find.include = [ "rest_framework*" ]
79+
package-data.rest_framework = [
9080
"locale/**/*.mo",
81+
"static/**/*",
82+
"templates/**/*",
9183
]
84+
dynamic.version = { attr = "rest_framework.__version__" }
9285

9386
[tool.isort]
94-
skip = [ ".tox" ]
9587
atomic = true
9688
multi_line_output = 5
9789
extra_standard_library = [ "types" ]
98-
known_third_party = [ "pytest", "_pytest", "django", "uritemplate" ]
90+
known_third_party = [ "_pytest", "django", "pytest", "uritemplate" ]
9991
known_first_party = [ "rest_framework", "tests" ]
92+
skip = [ ".tox" ]
10093

10194
[tool.flake8]
10295
extend-ignore = [ "E501", "W503", "W504", "B" ]
10396
extend-select = [ "B006" ]
10497
banned-modules = "json = use from rest_framework.utils import json!"
10598

10699
[tool.codespell]
107-
# Ref: https://github.com/codespell-project/codespell#using-a-config-file
108-
skip = "*/kickstarter-announcement.md,*.js,*.map,*.po,*.css,locale"
100+
builtin = "clear,rare,code,names,en-GB_to_en-US"
109101
ignore-words = "codespell-ignore-words.txt"
110102
ignore-words-list = "commitish"
111-
builtin = "clear,rare,code,names,en-GB_to_en-US"
103+
# Ref: https://github.com/codespell-project/codespell#using-a-config-file
104+
skip = "*/kickstarter-announcement.md,*.js,*.map,*.po,*.css,locale"
112105

113106
[tool.pyproject-fmt]
114-
max_supported_python = "3.14"
115107
keep_full_version = true
108+
max_supported_python = "3.14"
116109

117110
[tool.pytest]
118111
addopts = [
@@ -121,23 +114,21 @@ addopts = [
121114
"-ra",
122115
"--no-migrations",
123116
]
124-
testpaths = [ "tests" ]
125-
markers = [
126-
"requires_postgres: marks tests as requiring a PostgreSQL database backend",
127-
]
128117
filterwarnings = [
129118
"ignore:'cgi' is deprecated:DeprecationWarning",
130119
]
120+
markers = [
121+
"requires_postgres: marks tests as requiring a PostgreSQL database backend",
122+
]
123+
testpaths = [ "tests" ]
131124

132-
[tool.coverage.run]
125+
[tool.coverage]
133126
# NOTE: source is ignored with pytest-cov (but uses the same).
134-
source = [ "." ]
135-
include = [ "rest_framework/*", "tests/*" ]
136-
branch = true
137-
138-
[tool.coverage.report]
139-
include = [ "rest_framework/*", "tests/*" ]
140-
exclude_lines = [
127+
run.source = [ "." ]
128+
run.include = [ "rest_framework/*", "tests/*" ]
129+
run.branch = true
130+
report.include = [ "rest_framework/*", "tests/*" ]
131+
report.exclude_lines = [
141132
"pragma: no cover",
142133
"raise NotImplementedError",
143134
]

‎rest_framework/parsers.py‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,9 @@
1212
from django.core.files.uploadhandler import StopFutureHandlers
1313
from django.http import QueryDict
1414
from django.http.multipartparser import ChunkIter
15-
from django.http.multipartparser import \
15+
from django.http.multipartparser import (
1616
MultiPartParser as DjangoMultiPartParser
17+
)
1718
from django.http.multipartparser import MultiPartParserError
1819
from django.utils.http import parse_header_parameters
1920

‎tests/test_authtoken.py‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,9 @@
1010
from django.test import TestCase, modify_settings
1111

1212
from rest_framework.authtoken.admin import TokenAdmin
13-
from rest_framework.authtoken.management.commands.drf_create_token import \
13+
from rest_framework.authtoken.management.commands.drf_create_token import (
1414
Command as AuthTokenCommand
15+
)
1516
from rest_framework.authtoken.models import Token, TokenProxy
1617
from rest_framework.authtoken.serializers import AuthTokenSerializer
1718
from rest_framework.exceptions import ValidationError

0 commit comments

Comments
 (0)