Skip to content

Commit b825aed

Browse files
committed
Add py312 support
1 parent a3e5636 commit b825aed

File tree

10 files changed

+59
-59
lines changed

10 files changed

+59
-59
lines changed

.github/workflows/main.yml

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -19,33 +19,33 @@ 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.0-rc.3"]
22+
python-version: [3.8, 3.9, "3.10", "3.11", "3.12"]
2323
django-version:
2424
- "Django>=4.2,<5.0"
25-
- "Django>=5.0a1,<5.1"
25+
- "Django>=5.0,<5.1"
2626
# - "https://github.com/django/django/archive/main.tar.gz"
2727
include:
2828
- drf: djangorestframework
29-
python-version: "3.11"
29+
python-version: "3.12"
3030
django-version: "Django<5.0,>=4.2" # must be different from django-version
3131
exclude:
32-
- django-version: "Django>=5.0a1,<5.1"
32+
- django-version: "Django>=5.0,<5.1"
3333
python-version: 3.8
34-
- django-version: "Django>=5.0a1,<5.1"
34+
- django-version: "Django>=5.0,<5.1"
3535
python-version: 3.9
36-
36+
# - django-version: "https://github.com/django/django/archive/main.tar.gz"
37+
# python-version: 3.8
38+
# - django-version: "https://github.com/django/django/archive/main.tar.gz"
39+
# python-version: 3.9
40+
#
3741
steps:
38-
- uses: actions/checkout@v3
39-
- uses: actions/setup-python@v4
42+
- uses: actions/checkout@v4
43+
- uses: actions/setup-python@v5
4044
if: "!endsWith(matrix.python-version, '-dev')"
4145
with:
4246
python-version: ${{ matrix.python-version }}
4347
cache: "pip"
4448
cache-dependency-path: "pyproject.toml"
45-
- uses: deadsnakes/[email protected]
46-
if: endsWith(matrix.python-version, '-dev')
47-
with:
48-
python-version: ${{ matrix.python-version }}
4949
- name: Install deps
5050
run: |
5151
python -m pip install -e .[test]
@@ -58,13 +58,13 @@ jobs:
5858
env:
5959
PYTHONPATH: "src"
6060
steps:
61-
- uses: actions/checkout@v3
62-
- uses: actions/setup-python@v4
61+
- uses: actions/checkout@v4
62+
- uses: actions/setup-python@v5
6363
with:
64-
python-version: "3.11"
64+
python-version: "3.12"
6565
cache: "pip"
6666
cache-dependency-path: "pyproject.toml"
67-
- uses: actions/cache@v3
67+
- uses: actions/cache@v4
6868
with:
6969
path: ~/.cache/pre-commit
7070
key: pre-commit|${{ env.pythonLocation }}|${{ hashFiles('.pre-commit-config.yaml') }}
@@ -75,11 +75,11 @@ jobs:
7575
runs-on: ubuntu-latest
7676
timeout-minutes: 5
7777
steps:
78-
- uses: actions/checkout@v3
78+
- uses: actions/checkout@v4
7979
- name: Setup Python
80-
uses: actions/setup-python@v4
80+
uses: actions/setup-python@v5
8181
with:
82-
python-version: "3.11"
82+
python-version: "3.12"
8383
cache: "pip"
8484
cache-dependency-path: "pyproject.toml"
8585
- name: Install dependencies
@@ -88,7 +88,7 @@ jobs:
8888
- name: Package
8989
run: python -m hatch build
9090
- name: Upload dist
91-
uses: actions/upload-artifact@v3
91+
uses: actions/upload-artifact@v4
9292
with:
9393
name: dist
9494
path: dist
@@ -99,7 +99,7 @@ jobs:
9999
if: startsWith(github.ref, 'refs/tags/v')
100100
timeout-minutes: 5
101101
steps:
102-
- uses: actions/checkout@v3
102+
- uses: actions/checkout@v4
103103
- name: Set release env
104104
id: release_output
105105
run: |
@@ -114,11 +114,11 @@ jobs:
114114
echo "::set-output name=VERSION::${VERSION}"
115115
echo "::set-output name=BODY::${BODY}"
116116
- name: Setup Python
117-
uses: actions/setup-python@v4
117+
uses: actions/setup-python@v5
118118
with:
119-
python-version: "3.11"
119+
python-version: "3.12"
120120
- name: Download dist
121-
uses: actions/download-artifact@v3
121+
uses: actions/download-artifact@v4
122122
with:
123123
name: dist
124124
path: dist

.pre-commit-config.yaml

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,15 @@ repos:
55
- id: black
66
types: [python]
77

8-
- repo: https://github.com/charliermarsh/ruff-pre-commit
9-
rev: v0.0.260
8+
9+
- repo: https://github.com/astral-sh/ruff-pre-commit
10+
rev: v0.2.1
1011
hooks:
1112
- id: ruff
1213
language: system
1314
args: [--fix, --exit-non-zero-on-fix]
15+
- id: ruff-format
16+
language: system
1417

1518
- repo: https://github.com/pre-commit/pre-commit-hooks
1619
rev: v4.4.0
@@ -28,12 +31,12 @@ repos:
2831
- id: mypy
2932
name: mypy
3033
language: system
31-
entry: env PYTHONPATH=src mypy
34+
entry: mypy
3235
args: [src/extra_checks, tests]
3336
pass_filenames: false
3437
- id: django-check
3538
name: django check
3639
language: system
37-
entry: env PYTHONPATH=src DJANGO_SETTINGS_MODULE=tests.settings django-admin
40+
entry: env PYTHONPATH=src:. DJANGO_SETTINGS_MODULE=tests.settings django-admin
3841
args: [check, --fail-level, CRITICAL]
3942
pass_filenames: false

CHANGELOG.md

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

33
### Unreleased
44

5+
### 0.14.0
6+
57
- Remove `field-boolean-null`
68
- Deprecate `no-index-together`
79
- Drop support for python < 3.8
810
- Drop support for django < 4.2
11+
- Add python 3.12 to test matrix
912

1013
### 0.13.3
1114

pyproject.toml

Lines changed: 13 additions & 14 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.7"
11+
requires-python = ">=3.8"
1212
authors = [
1313
{ name = "Konstantin Alekseev", email = "[email protected]" },
1414
]
@@ -20,27 +20,22 @@ classifiers = [
2020
"Development Status :: 4 - Beta",
2121
"Environment :: Web Environment",
2222
"Framework :: Django",
23-
"Framework :: Django :: 3.2",
24-
"Framework :: Django :: 4.0",
25-
"Framework :: Django :: 4.1",
23+
"Framework :: Django :: 4.2",
24+
"Framework :: Django :: 5.0",
2625
"Intended Audience :: Developers",
2726
"License :: OSI Approved :: MIT License",
2827
"Operating System :: OS Independent",
2928
"Programming Language :: Python",
3029
"Programming Language :: Python :: 3",
31-
"Programming Language :: Python :: 3.7",
3230
"Programming Language :: Python :: 3.8",
3331
"Programming Language :: Python :: 3.9",
3432
"Programming Language :: Python :: 3.10",
3533
"Programming Language :: Python :: 3.11",
36-
]
37-
dependencies = [
38-
"typing-extensions ; python_version < \"3.8\"",
34+
"Programming Language :: Python :: 3.12",
3935
]
4036

4137
[project.optional-dependencies]
4238
dev = [
43-
"black",
4439
"Django",
4540
"django-stubs",
4641
"djangorestframework",
@@ -64,13 +59,14 @@ source = "vcs"
6459
raw-options = { local_scheme = "no-local-version" }
6560

6661
[tool.hatch.build.targets.sdist]
67-
include = [
68-
"/src",
69-
]
62+
include = ["/src"]
63+
[tool.hatch.build.targets.wheel]
64+
packages = ["src/extra_checks"]
7065

7166
[tool.ruff]
7267
src = ["src"]
73-
target-version = "py37"
68+
target-version = "py38"
69+
[tool.ruff.lint]
7470
select = [
7571
'B',
7672
'C',
@@ -81,18 +77,21 @@ select = [
8177
'UP',
8278
'RUF',
8379
'INP',
84-
'I'
80+
'I',
81+
'TCH',
8582
]
8683
ignore = [
8784
'E501',
8885
'B904',
8986
'B905',
9087
'RUF012',
9188
]
89+
extend-safe-fixes = ["TCH"]
9290

9391
[tool.pytest.ini_options]
9492
addopts = "-p no:doctest --cov=extra_checks --cov-branch --ds=tests.settings"
9593
django_find_project = false
94+
pythonpath = "."
9695

9796
[tool.mypy]
9897
plugins = ["mypy_django_plugin.main"]

shell.nix

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,18 +9,14 @@ in
99
devshell.mkShell {
1010
name = "django-extra-checks";
1111
packages = [
12-
nixpkgs.python311
12+
nixpkgs.python312
1313
];
1414

1515
env = [
1616
{
1717
name = "PYTHONUNBUFFERED";
1818
value = "1";
1919
}
20-
{
21-
name = "PYTHONPATH";
22-
eval = "$PWD";
23-
}
2420
{
2521
name = "DJANGO_SETTINGS_MODULE";
2622
value = "tests.settings";

src/extra_checks/ast/ast.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,8 +95,11 @@ def _assignments(self) -> Dict[str, ast.Assign]:
9595
def field_nodes(self) -> Iterable[Tuple[models.fields.Field, "FieldAST"]]:
9696
for field in self.model_cls._meta.get_fields(include_parents=False):
9797
if isinstance(field, models.Field):
98-
yield field, cast(
99-
FieldAST, SimpleLazyObject(partial(get_field_ast, self, field))
98+
yield (
99+
field,
100+
cast(
101+
FieldAST, SimpleLazyObject(partial(get_field_ast, self, field))
102+
),
100103
)
101104

102105
def has_meta_var(self, name: str) -> bool:

src/extra_checks/ast/protocols.py

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,4 @@
1-
import sys
2-
from typing import Any, Iterable, Optional, Tuple
3-
4-
if sys.version_info >= (3, 8):
5-
from typing import Protocol
6-
else:
7-
from typing_extensions import Protocol
1+
from typing import Any, Iterable, Optional, Protocol, Tuple
82

93
from django.db import models
104

src/extra_checks/checks/drf_serializer_checks.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ def _get_serializers_to_check(
9999
) -> Tuple[Iterator[Type[Serializer]], Iterator[Type[ModelSerializer]]]:
100100
serializer_classes = _filter_app_serializers(
101101
collect_subclasses(
102-
s for s in Serializer.__subclasses__() if s is not ModelSerializer # type: ignore
102+
s for s in Serializer.__subclasses__() if s is not ModelSerializer
103103
),
104104
include_apps,
105105
)

src/extra_checks/forms.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,9 @@ def clean(self) -> typing.Dict[str, typing.Any]:
167167
del self.cleaned_data["level"]
168168
return self.cleaned_data
169169

170-
def is_valid(self, check_forms: typing.Dict[CheckId, "typing.Type[BaseCheckForm]"]) -> bool: # type: ignore
170+
def is_valid( # type: ignore
171+
self, check_forms: typing.Dict[CheckId, "typing.Type[BaseCheckForm]"]
172+
) -> bool:
171173
if not super().is_valid():
172174
return False
173175
checks = self.cleaned_data.get("checks", {})

src/extra_checks/registry.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ def create(
5959

6060
@staticmethod
6161
def _build_ignored(
62-
ignore_checks: Dict[Any, Set[Union[str, CheckId]]]
62+
ignore_checks: Dict[Any, Set[Union[str, CheckId]]],
6363
) -> Tuple[Dict[CheckId, Set[Any]], List[str]]:
6464
errors = []
6565
ignored: Dict[CheckId, set] = {}

0 commit comments

Comments
 (0)