8000 Switch to pyproject.toml + PEP621 (#2688) · typeddjango/django-stubs@3899c61 · GitHub
[go: up one dir, main page]

Skip to content

Commit 3899c61

Browse files
Switch to pyproject.toml + PEP621 (#2688)
1 parent 6a7ea60 commit 3899c61

File tree

9 files changed

+141
-169
lines changed

9 files changed

+141
-169
lines changed

.github/workflows/test.yml

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@ jobs:
3030
python-version: ${{ matrix.python-version }}
3131
- name: Install dependencies
3232
run: |
33-
pip install -U pip "setuptools<79.0.0" wheel
34-
SETUPTOOLS_ENABLE_FEATURES=legacy-editable pip install -r ./requirements.txt
33+
pip install -U pip
34+
pip install -r ./requirements.txt
3535
3636
- name: Run mypy on plugin code
3737
run: mypy --strict mypy_django_plugin
@@ -63,8 +63,8 @@ jobs:
6363
python-version: ${{ matrix.python-version }}
6464
- name: Install dependencies
6565
run: |
66-
pip install -U pip "setuptools<79.0.0" wheel
67-
SETUPTOOLS_ENABLE_FEATURES=legacy-editable pip install -r ./requirements.txt
66+
pip install -U pip
67+
pip install -r ./requirements.txt
6868
6969
# Must match `shard` definition in the test matrix:
7070
- name: Run pytest tests
@@ -91,8 +91,8 @@ jobs:
9191
python-version: ${{ matrix.python-version }}
9292
- name: Install dependencies
9393
run: |
94-
pip install -U pip "setuptools<79.0.0" wheel
95-
SETUPTOOLS_ENABLE_FEATURES=legacy-editable pip install -r ./requirements.txt
94+
pip install -U pip
95+
pip install -r ./requirements.txt
9696
9797
- name: Run stubtest
9898
run: ./scripts/stubtest.sh
@@ -112,8 +112,8 @@ jobs:
112112
python-version: ${{ matrix.python-version }}
113113
- name: Install dependencies
114114
run: |
115-
pip install -U pip "setuptools<79.0.0" wheel
116-
SETUPTOOLS_ENABLE_FEATURES=legacy-editable pip install -r ./requirements.txt
115+
pip install -U pip
116+
pip install -r ./requirements.txt
117117
- name: Run pyright on the stubs
118118
uses: jakebailey/pyright-action@v2
119119
with:
@@ -146,8 +146,8 @@ jobs:
146146
python-version: ${{ matrix.python-version }}
147147
- name: Install dependencies
148148
run: |
149-
pip install -U pip "setuptools<79.0.0" wheel
150-
SETUPTOOLS_ENABLE_FEATURES=legacy-editable pip install -r ./requirements.txt
149+
pip install -U pip
150+
pip install -r ./requirements.txt
151151
pip install "Django==${{ matrix.django-version }}"
152152
pip check
153153
@@ -167,8 +167,8 @@ jobs:
167167
run: python3 -m pip install --upgrade build twine
168168
- name: Build
169169
run: |
170-
python3 -m build --sdist --wheel .
171-
python3 -m build --sdist --wheel ext/
170+
python3 -m build .
171+
python3 -m build ext/
172172
- name: Check package metadata
173173
run: |
174174
twine check --strict dist/*

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,3 +13,4 @@ pip-wheel-metadata/
1313
stubgen/
1414
build/
1515
dist/
16+
ext/dist/

CONTRIBUTING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ source .venv/bin/activate
4444
Then install the dev requirements:
4545

4646
```bash
47-
SETUPTOOLS_ENABLE_FEATURES=legacy-editable pip install -r ./requirements.txt
47+
pip install -r ./requirements.txt
4848
```
4949

5050
Finally, install the pre-commit hooks:

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ We rely on different `django` and `mypy` versions:
4949

5050
| django-stubs | Mypy version | Django version | Django partial support | Python version |
5151
|----------------|--------------|----------------|------------------------|----------------|
52-
| 5.2.0 | 1.13+ | 5.2 | 5.1 | 3.10 - 3.13 |
52+
| 5.2.0 | 1.13+ | 5.2 | 5.1, 5.0 | 3.10 - 3.13 |
5353
| 5.1.3 | 1.13+ | 5.1 | 4.2 | 3.9 - 3.13 |
5454
| 5.1.2 | 1.13+ | 5.1 | 4.2 | 3.9 - 3.13 |
5555
| 5.1.1 | 1.13.x | 5.1 | 4.2 | 3.8 - 3.12 |

ext/pyproject.toml

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
[build-system]
2+
build-backend = "hatchling.build"
3+
requires = ["hatchling"]
4+
5+
[project]
6+
name = "django-stubs-ext"
7+
# NB! For clarity, keep version major.minor.patch in sync with django-stubs.
8+
# It's fine to skip django-stubs-ext releases, but when doing a release, update this to newest django-stubs version.
9+
version = "5.2.0"
10+
description = "Monkey-patching and extensions for django-stubs"
11+
readme = "README.md"
12+
license = "MIT"
13+
license-files = ["LICENSE.md"]
14+
maintainers = [
15+
{ name = "Marti Raudsepp", email = "marti@juffo.org" },
16+
{ name = "Nikita Sobolev", email = "mail@sobolevn.me" },
17+
{ name = "Petter Friberg", email = "petter_friberg@hotmail.com" },
18+
{ name = "Adam Johnson", email = "me@adamj.eu" },
19+
]
20+
authors = [
21+
{ name = "Simula Proxy" },
22+
]
23+
requires-python = ">=3.10"
24+
classifiers = [
25+
"Operating System :: OS Independent",
26+
"Programming Language :: Python :: 3.10",
27+
"Programming Language :: Python :: 3.11",
28+
"Programming Language :: Python :: 3.12",
29+
"Programming Language :: Python :: 3.13",
30+
"Typing :: Typed",
31+
"Framework :: Django",
32+
"Framework :: Django :: 5.0",
33+
"Framework :: Django :: 5.1",
34+
"Framework :: Django :: 5.2",
35+
]
36+
dependencies = [
37+
"django",
38+
"typing-extensions",
39+
]
40+
41+
[project.urls]
42+
Homepage = "https://github.com/typeddjango/django-stubs"
43+
Funding = "https://github.com/sponsors/typeddjango"
44+
"Release notes" = "https://github.com/typeddjango/django-stubs/releases"
45+
46+
[tool.hatch.build]
47+
packages = ["django_stubs_ext"]

ext/setup.py

Lines changed: 0 additions & 48 deletions
This file was deleted.

mypy.ini

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,6 @@ plugins =
3535
disallow_untyped_defs = false
3636
disallow_incomplete_defs = false
3737

38-
[mypy-cryptography.*]
39-
ignore_errors = true
40-
4138
# Our settings:
4239
[mypy.plugins.django-stubs]
4340
django_settings_module = scripts.django_tests_settings

pyproject.toml

Lines changed: 79 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,59 @@
1+
[build-system]
2+
requires = ["hatchling"]
3+
build-backend = "hatchling.build"
4+
5+
[project]
6+
name = "django-stubs"
7+
version = "5.2.0"
8+
description = "Mypy stubs for Django"
9+
readme = "README.md"
10+
license = "MIT"
11+
license-files = ["LICENSE.md"]
12+
requires-python = ">=3.10"
13+
authors = [
14+
{ name = "Maksim Kurnikov", email = "maxim.kurnikov@gmail.com" },
15+
]
16+
maintainers = [
17+
{ name = "Marti Raudsepp", email = "marti@juffo.org" },
18+
{ name = "Nikita Sobolev", email = "mail@sobolevn.me" },
19+
{ name = "Petter Friberg", email = "petter_friberg@hotmail.com" },
20+
{ name = "Adam Johnson", email = "me@adamj.eu" },
21+
]
22+
classifiers = [
23+
"Operating System :: OS Independent",
24+
"Programming Language :: Python :: 3.10",
25+
"Programming Language :: Python :: 3.11",
26+
"Programming Language :: Python :: 3.12",
27+
"Programming Language :: Python :: 3.13",
28+
"Typing :: Typed",
29+
"Framework :: Django",
30+
"Framework :: Django :: 5.0",
31+
"Framework :: Django :: 5.1",
32+
"Framework :: Django :: 5.2",
33+
]
34+
dependencies = [
35+
"django",
36+
"django-stubs-ext>=5.2.0",
37+
"tomli; python_version < '3.11'",
38+
# Types:
39+
"types-pyyaml",
40+
"typing-extensions>=4.11.0",
41+
]
42+
43+
[project.optional-dependencies]
44+
compatible-mypy = ["mypy>=1.13,<1.16"]
45+
oracle = ["oracledb"]
46+
redis = ["redis", "types-redis"]
47+
48+
[project.urls]
49+
Homepage = "https://github.com/typeddjango/django-stubs"
50+
Funding = "https://github.com/sponsors/typeddjango"
51+
"Release notes" = "https://github.com/typeddjango/django-stubs/releases"
52+
53+
[tool.hatch.build]
54+
packages = ["django-stubs", "mypy_django_plugin"]
55+
56+
157
[tool.codespell]
258
ignore-words-list = "aadd,acount,nam,asend"
359

@@ -9,35 +65,35 @@ target-version = "py310"
965
[tool.ruff.lint]
1066
# See Rules in Ruff documentation: https://beta.ruff.rs/docs/rules/
1167
select = [
12-
"B", # bugbear
13-
"E", # pycodestyle
14-
"F", # pyflakes
15-
"INP", # flake8-tidy-imports
16-
"W", # pycodestyle
17-
"I", # isort
18-
"UP", # pyupgrade
19-
"TID251", # Disallowed imports (flake8-tidy-imports.banned-api)
20-
"PYI", # flake8-pyi
21-
"RUF100", # Equivalent to flake8-noqa NQA103
22-
"PGH004", # Equivalent to flake8-noqa NQA104
23-
"PGH003", # Disallowed blanket `type: ignore` annotations.
68+
"B", # bugbear
69+
"E", # pycodestyle
70+
"F", # pyflakes
71+
"INP", # flake8-tidy-imports
72+
"W", # pycodestyle
73+
"I", # isort
74+
"UP", # pyupgrade
75+
"TID251", # Disallowed imports (flake8-tidy-imports.banned-api)
76+
"PYI", # flake8-pyi
77+
"RUF100", # Equivalent to flake8-noqa NQA103
78+
"PGH004", # Equivalent to flake8-noqa NQA104
79+
"PGH003", # Disallowed blanket `type: ignore` annotations.
2480
]
2581
ignore = [
26-
"PYI021", # We have a few meaningful docstrings for stubs only constructs/utilities.
27-
"PYI041", # This might not be obvious that `float | int` is mostly equivalent to `float` typing wise | int | str
28-
"PYI043",
82+
"PYI021", # We have a few meaningful docstrings for stubs only constructs/utilities.
83+
"PYI041", # This might not be obvious that `float | int` is mostly equivalent to `float` typing wise | int | str
84+
"PYI043",
2985
]
3086

3187
[tool.ruff.lint.per-file-ignores]
3288
"*.pyi" = [
33-
"B",
34-
"E501",
35-
"E741",
36-
"E743",
37-
"F403", # Use wildcard import
38-
"F405",
39-
"F822",
40-
"F821",
89+
"B",
90+
"E501",
91+
"E741",
92+
"E743",
93+
"F403", # Use wildcard import
94+
"F405",
95+
"F822",
96+
"F821",
4197
]
4298
"tests/*.py" = ["INP001", "PGH003"]
4399
"ext/tests/*.py" = ["INP001"]
@@ -50,6 +106,3 @@ ignore = [
50106
[tool.ruff.lint.isort]
51107
known-first-party = ["django_stubs_ext", "mypy_django_plugin"]
52108
split-on-trailing-comma = false
53-
54-
[build-system]
55-
requires = ["setuptools<79.0.0", "wheel"]

0 commit comments

Comments
 (0)
0