Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ repos:
- id: check-symlinks
- id: check-toml
- repo: https://github.com/PyCQA/isort
rev: 7.0.0
rev: 9.0.1
hooks:
- id: isort
- repo: https://github.com/PyCQA/flake8
Expand All @@ -28,7 +28,7 @@ repos:
- black==26.1.0
- repo: https://github.com/codespell-project/codespell
# Configuration for codespell is in pyproject.toml
rev: v2.4.1
rev: v2.4.3
hooks:
- id: codespell
additional_dependencies:
Expand All @@ -40,10 +40,10 @@ repos:
- id: pyupgrade
args: ["--py310-plus", "--keep-percent-format"]
- repo: https://github.com/tox-dev/pyproject-fmt
rev: v2.11.1
rev: v2.29.4
hooks:
- id: pyproject-fmt
- repo: https://github.com/adamchainz/django-upgrade
rev: 1.24.0
rev: 1.32.0
hooks:
- id: django-upgrade
59 changes: 25 additions & 34 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ test = [
"pytest==9.*",
"pytest-cov==7.*",
"pytest-django>=4.5.2,<5",

]
docs = [
# MkDocs to build our documentation.
Expand All @@ -57,6 +56,10 @@ docs = [
# pylinkvalidator to check for broken links in documentation.
"pylinkvalidator==0.3",
]
django52 = [ "django>=5.2,<6.0" ]
django60 = [ "django>=6.0,<6.1" ]
django61 = [ "django>=6.1,<6.2" ]
djangomain = [ "django @ https://github.com/django/django/archive/main.tar.gz" ]
optional = [
# Optional packages which may be used with REST framework.
"django-filter",
Expand All @@ -70,49 +73,39 @@ optional = [
"requests",
"uritemplate",
]
django52 = [ "django>=5.2,<6.0" ]
django60 = [ "django>=6.0,<6.1" ]
django61 = [ "django>=6.1,<6.2" ]
djangomain = [ "django @ https://github.com/django/django/archive/main.tar.gz" ]

[tool.setuptools]

[tool.setuptools.dynamic]
version = { attr = "rest_framework.__version__" }

[tool.setuptools.packages.find]
include = [ "rest_framework*" ]

[tool.setuptools.package-data]
"rest_framework" = [
"templates/**/*",
"static/**/*",
packages.find.include = [ "rest_framework*" ]
package-data.rest_framework = [
"locale/**/*.mo",
"static/**/*",
"templates/**/*",
]
dynamic.version = { attr = "rest_framework.__version__" }

[tool.isort]
skip = [ ".tox" ]
atomic = true
multi_line_output = 5
extra_standard_library = [ "types" ]
known_third_party = [ "pytest", "_pytest", "django", "uritemplate" ]
known_third_party = [ "_pytest", "django", "pytest", "uritemplate" ]
known_first_party = [ "rest_framework", "tests" ]
skip = [ ".tox" ]

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

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

[tool.pyproject-fmt]
max_supported_python = "3.14"
keep_full_version = true
max_supported_python = "3.14"

[tool.pytest]
addopts = [
Expand All @@ -121,23 +114,21 @@ addopts = [
"-ra",
"--no-migrations",
]
testpaths = [ "tests" ]
markers = [
"requires_postgres: marks tests as requiring a PostgreSQL database backend",
]
filterwarnings = [
"ignore:'cgi' is deprecated:DeprecationWarning",
]
markers = [
"requires_postgres: marks tests as requiring a PostgreSQL database backend",
]
testpaths = [ "tests" ]

[tool.coverage.run]
[tool.coverage]
# NOTE: source is ignored with pytest-cov (but uses the same).
source = [ "." ]
include = [ "rest_framework/*", "tests/*" ]
branch = true

[tool.coverage.report]
include = [ "rest_framework/*", "tests/*" ]
exclude_lines = [
run.source = [ "." ]
run.include = [ "rest_framework/*", "tests/*" ]
run.branch = true
report.include = [ "rest_framework/*", "tests/*" ]
report.exclude_lines = [
"pragma: no cover",
"raise NotImplementedError",
]
3 changes: 2 additions & 1 deletion rest_framework/parsers.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,9 @@
from django.core.files.uploadhandler import StopFutureHandlers
from django.http import QueryDict
from django.http.multipartparser import ChunkIter
from django.http.multipartparser import \
from django.http.multipartparser import (
MultiPartParser as DjangoMultiPartParser
)
from django.http.multipartparser import MultiPartParserError
from django.utils.http import parse_header_parameters

Expand Down
3 changes: 2 additions & 1 deletion tests/test_authtoken.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,9 @@
from django.test import TestCase, modify_settings

from rest_framework.authtoken.admin import TokenAdmin
from rest_framework.authtoken.management.commands.drf_create_token import \
from rest_framework.authtoken.management.commands.drf_create_token import (
Command as AuthTokenCommand
)
from rest_framework.authtoken.models import Token, TokenProxy
from rest_framework.authtoken.serializers import AuthTokenSerializer
from rest_framework.exceptions import ValidationError
Expand Down