Skip to content

Commit 10b8ecb

Browse files
committed
drop python 3.8
1 parent 2cd7474 commit 10b8ecb

File tree

18 files changed

+910
-122
lines changed

18 files changed

+910
-122
lines changed

.github/workflows/main.yml

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,24 +19,23 @@ jobs:
1919
strategy:
2020
matrix:
2121
# https://github.com/actions/python-versions/blob/main/versions-manifest.json
22-
python-version: [3.8, 3.9, "3.10", "3.11", "3.12", "3.13"]
22+
python-version: [3.9, "3.10", "3.11", "3.12", "3.13"]
2323
django-version:
2424
- "Django>=4.2,<5.0"
2525
- "Django>=5.0,<5.1"
2626
- "Django>=5.1,<5.2"
27+
- "Django==5.2a1"
2728
# - "https://github.com/django/django/archive/main.tar.gz"
2829
include:
2930
- drf: djangorestframework
3031
python-version: "3.12"
3132
django-version: "Django<5.2,>=5.0" # must be different from django-version
3233
exclude:
33-
- django-version: "Django>=5.0,<5.1"
34-
python-version: 3.8
3534
- django-version: "Django>=5.0,<5.1"
3635
python-version: 3.9
3736
- django-version: "Django>=5.1,<5.2"
38-
python-version: 3.8
39-
- django-version: "Django>=5.1,<5.2"
37+
python-version: 3.9
38+
- django-version: "Django==5.2a1"
4039
python-version: 3.9
4140
# - django-version: "https://github.com/django/django/archive/main.tar.gz"
4241
# python-version: 3.8

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22

33
### Unreleased
44

5+
- drop python 3.8 support
6+
- add django 5.2 to test matrix
7+
58
### 0.16.1
69

710
- fix `field-choices-constraint`

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ EXTRA_CHECKS = {
126126

127127
## Development
128128

129-
Install dev deps in virtualenv `pip install -e .[dev,test]`.
129+
Install dev deps in virtualenv `uv sync --group test`.
130130

131131
## Credits
132132

conftest.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,9 @@ def handler(self, handler):
3535
def run(self):
3636
self._registry.enabled_checks = {}
3737
handlers = self._registry.bind()
38-
assert (
39-
self._registry.is_healthy
40-
), f"Settings has errors: {self._registry._config.errors.as_text()}"
38+
assert self._registry.is_healthy, (
39+
f"Settings has errors: {self._registry._config.errors.as_text()}"
40+
)
4141
return list(handlers[self.TEST_TAG]())
4242

4343
def models(self, *models):

pyproject.toml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ dynamic = ["version"]
88
description = "Collection of useful checks for Django Checks Framework"
99
readme = "README.md"
1010
license = "MIT"
11-
requires-python = ">=3.8"
11+
requires-python = ">=3.9"
1212
authors = [
1313
{ name = "Konstantin Alekseev", email = "[email protected]" },
1414
]
@@ -23,20 +23,20 @@ classifiers = [
2323
"Framework :: Django :: 4.2",
2424
"Framework :: Django :: 5.0",
2525
"Framework :: Django :: 5.1",
26+
"Framework :: Django :: 5.2",
2627
"Intended Audience :: Developers",
2728
"License :: OSI Approved :: MIT License",
2829
"Operating System :: OS Independent",
2930
"Programming Language :: Python",
3031
"Programming Language :: Python :: 3",
31-
"Programming Language :: Python :: 3.8",
3232
"Programming Language :: Python :: 3.9",
3333
"Programming Language :: Python :: 3.10",
3434
"Programming Language :: Python :: 3.11",
3535
"Programming Language :: Python :: 3.12",
3636
"Programming Language :: Python :: 3.13",
3737
]
3838

39-
[project.optional-dependencies]
39+
[dependency-groups]
4040
dev = [
4141
"Django",
4242
"django-stubs",
@@ -67,7 +67,7 @@ packages = ["src/extra_checks"]
6767

6868
[tool.ruff]
6969
src = ["src"]
70-
target-version = "py38"
70+
target-version = "py39"
7171
[tool.ruff.lint]
7272
select = [
7373
'B',

src/extra_checks/ast/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from typing import Container, Type
1+
from collections.abc import Container
22

33
from django.db import models
44

@@ -14,7 +14,7 @@
1414

1515

1616
def get_model_ast(
17-
model_cls: Type[models.Model],
17+
model_cls: type[models.Model],
1818
meta_checks: Container[CheckId],
1919
) -> ModelASTDisableCommentProtocol:
2020
return ModelAST(model_cls, meta_checks)

src/extra_checks/ast/ast.py

Lines changed: 9 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,10 @@
11
import ast
2+
from collections.abc import Container, Iterable, Iterator
23
from functools import partial
34
from typing import (
45
TYPE_CHECKING,
56
Callable,
6-
Container,
7-
Dict,
8-
Iterable,
9-
Iterator,
10-
List,
117
Optional,
12-
Tuple,
13-
Type,
148
Union,
159
cast,
1610
)
@@ -36,10 +30,10 @@
3630

3731

3832
class ModelAST(DisableCommentProtocol, ModelASTProtocol):
39-
def __init__(self, model_cls: Type[models.Model], meta_checks: Container[CheckId]):
33+
def __init__(self, model_cls: type[models.Model], meta_checks: Container[CheckId]):
4034
self.model_cls = model_cls
4135
self.meta_checks = meta_checks
42-
self._assignment_nodes: List[ast.Assign] = []
36+
self._assignment_nodes: list[ast.Assign] = []
4337
self._meta: Optional[ast.ClassDef] = None
4438

4539
@cached_property
@@ -73,8 +67,8 @@ def _meta_node(self) -> Optional[ast.ClassDef]:
7367
return self._meta
7468

7569
@cached_property
76-
def _meta_vars(self) -> Dict[str, ast.Assign]:
77-
data: Dict[str, ast.Assign] = {}
70+
def _meta_vars(self) -> dict[str, ast.Assign]:
71+
data: dict[str, ast.Assign] = {}
7872
if not self._meta_node:
7973
return data
8074
for node in ast.iter_child_nodes(self._meta_node):
@@ -83,7 +77,7 @@ def _meta_vars(self) -> Dict[str, ast.Assign]:
8377
return data
8478

8579
@cached_property
86-
def _assignments(self) -> Dict[str, ast.Assign]:
80+
def _assignments(self) -> dict[str, ast.Assign]:
8781
self._parse()
8882
result = {}
8983
for node in self._assignment_nodes:
@@ -92,7 +86,7 @@ def _assignments(self) -> Dict[str, ast.Assign]:
9286
return result
9387

9488
@cached_property
95-
def field_nodes(self) -> Iterable[Tuple[models.fields.Field, "FieldAST"]]:
89+
def field_nodes(self) -> Iterable[tuple[models.fields.Field, "FieldAST"]]:
9690
for field in self.model_cls._meta.get_fields(include_parents=False):
9791
if isinstance(field, models.Field):
9892
yield (
@@ -155,11 +149,11 @@ def __init__(
155149
self._source_provider = source_provider
156150

157151
@cached_property
158-
def _args(self) -> List[ast.expr]:
152+
def _args(self) -> list[ast.expr]:
159153
return self._node.value.args # type: ignore
160154

161155
@cached_property
162-
def _kwargs(self) -> Dict[str, ast.keyword]:
156+
def _kwargs(self) -> dict[str, ast.keyword]:
163157
return {kw.arg: kw for kw in self._node.value.keywords if kw.arg} # type: ignore
164158

165159
def get_arg(self, name: str) -> Optional[ArgASTProtocol]:

src/extra_checks/ast/protocols.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
from typing import Any, Iterable, Optional, Protocol, Tuple
1+
from collections.abc import Iterable
2+
from typing import Any, Optional, Protocol
23

34
from django.db import models
45

@@ -21,7 +22,7 @@ class ModelASTProtocol(Protocol):
2122
@property
2223
def field_nodes(
2324
self,
24-
) -> Iterable[Tuple[models.fields.Field, "FieldASTDisableCommentProtocol"]]: ...
25+
) -> Iterable[tuple[models.fields.Field, "FieldASTDisableCommentProtocol"]]: ...
2526

2627
def has_meta_var(self, name: str) -> bool: ...
2728

src/extra_checks/ast/source_provider.py

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
import inspect
22
import re
33
import textwrap
4-
from typing import TYPE_CHECKING, Dict, Iterable, Optional, Set, Type
4+
from collections.abc import Iterable
5+
from typing import TYPE_CHECKING, Optional
56

67
from extra_checks.check_id import ALL_CHECKS_NAMES, CheckId
78

@@ -14,7 +15,7 @@
1415
DISABLE_COMMENT_PATTERN = r"^#\s*extra-checks-disable-next-line(?:\s+(.*))?$"
1516

1617

17-
def _parse_comment(checks: Optional[str]) -> Set[str]:
18+
def _parse_comment(checks: Optional[str]) -> set[str]:
1819
if not checks:
1920
return ALL_CHECKS_NAMES # type: ignore
2021
result = set()
@@ -25,7 +26,7 @@ def _parse_comment(checks: Optional[str]) -> Set[str]:
2526
return result
2627

2728

28-
def _find_disabled_checks(comments: Iterable[str]) -> Set[str]:
29+
def _find_disabled_checks(comments: Iterable[str]) -> set[str]:
2930
result = set()
3031
for line in comments:
3132
m = re.match(DISABLE_COMMENT_PATTERN, line)
@@ -35,9 +36,9 @@ def _find_disabled_checks(comments: Iterable[str]) -> Set[str]:
3536

3637

3738
class SourceProvider:
38-
def __init__(self, obj: Type) -> None:
39+
def __init__(self, obj: type) -> None:
3940
self._obj = obj
40-
self._comments_cache: Dict[int, Set[str]] = {}
41+
self._comments_cache: dict[int, set[str]] = {}
4142

4243
@cached_property
4344
def source(self) -> Optional[str]:
@@ -63,7 +64,7 @@ def _get_line_comments(self, line_no: int) -> Iterable[str]:
6364
else:
6465
break
6566

66-
def get_disabled_checks_for_line(self, line_no: int) -> Set[str]:
67+
def get_disabled_checks_for_line(self, line_no: int) -> set[str]:
6768
if line_no not in self._comments_cache:
6869
comments = self._get_line_comments(line_no)
6970
self._comments_cache[line_no] = _find_disabled_checks(comments)

src/extra_checks/checks/base_checks.py

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,12 @@
11
import warnings
22
from abc import ABC, abstractmethod
3+
from collections.abc import Iterator
34
from typing import (
45
TYPE_CHECKING,
56
Any,
67
Callable,
78
ClassVar,
8-
Iterator,
9-
List,
109
Optional,
11-
Set,
12-
Type,
1310
)
1411

1512
import django.core.checks
@@ -28,14 +25,14 @@
2825

2926
class BaseCheck(ABC):
3027
Id: CheckId
31-
settings_form_class: ClassVar[Type[forms.BaseCheckForm]] = forms.BaseCheckForm
28+
settings_form_class: ClassVar[type[forms.BaseCheckForm]] = forms.BaseCheckForm
3229
level = django.core.checks.WARNING
33-
deprecation_warnings: List[str] = []
30+
deprecation_warnings: list[str] = []
3431

3532
def __init__(
3633
self,
3734
level: Optional[int] = None,
38-
ignore_objects: Optional[Set[Any]] = None,
35+
ignore_objects: Optional[set[Any]] = None,
3936
ignore_types: Optional[set] = None,
4037
skipif: Optional[Callable] = None,
4138
) -> None:

0 commit comments

Comments
 (0)