Skip to content

Commit 9a09383

Browse files
committed
Begin migration to PDM.
This will *not* require PDM in order to install or use django-registration, but will require PDM in order to build the distributable artifacts, run CI, and work on the package locally.
1 parent 5efeaa1 commit 9a09383

File tree

7 files changed

+1283
-63
lines changed

7 files changed

+1283
-63
lines changed

.github/workflows/ci.yml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ jobs:
2424
strategy:
2525
fail-fast: false
2626
matrix:
27-
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
27+
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"]
2828

2929
steps:
3030
- name: Harden Runner
@@ -42,6 +42,10 @@ jobs:
4242
- uses: actions/setup-python@v5
4343
with:
4444
python-version: ${{ matrix.python-version }}
45+
- name: Set up PDM
46+
uses: pdm-project/setup-pdm@v4
47+
with:
48+
python-version: ${{ matrix.python-version }}
4549
- name: "Install dependencies"
4650
run: |
4751
python -VV
@@ -50,4 +54,4 @@ jobs:
5054
python -Im pip install --upgrade nox
5155
python -Im nox --version
5256
- name: "Run CI suite with nox"
53-
run: "python -Im nox --non-interactive --error-on-external-run --python ${{ matrix.python-version }}"
57+
run: "python -Im nox --non-interactive --python ${{ matrix.python-version }}"

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,3 +135,6 @@ cython_debug/
135135
# IDEs.
136136
.idea/
137137
.vscode/
138+
139+
# PDM local file.
140+
.pdm-python

MANIFEST.in

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

noxfile.py

Lines changed: 26 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@
2323
nox.options.default_venv_backend = "venv"
2424
nox.options.reuse_existing_virtualenvs = True
2525

26+
os.environ.update({"PDM_IGNORE_SAVED_PYTHON": "1"})
27+
2628
PACKAGE_NAME = "django_registration"
2729

2830
NOXFILE_PATH = pathlib.Path(__file__).parents[0]
@@ -57,21 +59,22 @@ def clean(paths: typing.Iterable[pathlib.Path] = ARTIFACT_PATHS) -> None:
5759
@nox.parametrize(
5860
"python,django",
5961
[
60-
# Python/Django testing matrix. Tests Django 4.2, 5.0, 5.1 on Python 3.8 through
62+
# Python/Django testing matrix. Tests Django 4.2, 5.0, 5.1 on Python 3.9 through
6163
# 3.12, skipping unsupported combinations.
6264
(python, django)
63-
for python in ["3.8", "3.9", "3.10", "3.11", "3.12"]
65+
for python in ["3.9", "3.10", "3.11", "3.12", "3.13"]
6466
for django in ["4.2", "5.0", "5.1"]
6567
if (python, django)
66-
not in [("3.8", "5.0"), ("3.9", "5.0"), ("3.8", "5.1"), ("3.9", "5.1")]
68+
not in [("3.9", "5.0"), ("3.9", "5.1"), ("3.13", "4.2"), ("3.13", "5.0")]
6769
],
6870
)
6971
def tests_with_coverage(session: nox.Session, django: str) -> None:
7072
"""
7173
Run the package's unit tests, with coverage report.
7274
7375
"""
74-
session.install(f"Django~={django}.0", ".[tests]")
76+
session.install(f"Django~={django}.0")
77+
session.run_always("pdm", "install", "-dG", "tests", external=True)
7578
python_version = session.run(
7679
f"{session.bin}/python{session.python}", "--version", silent=True
7780
).strip()
@@ -115,18 +118,21 @@ def docs_build(session: nox.Session) -> None:
115118
Build the package's documentation as HTML.
116119
117120
"""
118-
session.install(".[docs]")
119-
session.chdir("docs")
121+
session.run_always("pdm", "install", "-dG", "docs", external=True)
122+
build_dir = session.create_tmp()
120123
session.run(
121124
f"{session.bin}/python{session.python}",
122125
"-Im",
123126
"sphinx",
124-
"-b",
127+
"--builder",
125128
"html",
126-
"-d",
127-
f"{session.bin}/../tmp/doctrees",
128-
".",
129-
f"{session.bin}/../tmp/html",
129+
"--write-all",
130+
"-c",
131+
"docs/",
132+
"--doctree-dir",
133+
f"{build_dir}/doctrees",
134+
"docs/",
135+
f"{build_dir}/html",
130136
)
131137
clean()
132138

@@ -160,19 +166,21 @@ def docs_spellcheck(session: nox.Session) -> None:
160166
Spell-check the package's documentation.
161167
162168
"""
163-
session.install("pyenchant", "sphinxcontrib-spelling", ".[docs]")
169+
session.run_always("pdm", "install", "-dG", "docs", external=True)
170+
session.install("pyenchant", "sphinxcontrib-spelling")
164171
build_dir = session.create_tmp()
165-
session.chdir("docs")
166172
session.run(
167173
f"{session.bin}/python{session.python}",
168174
"-Im",
169175
"sphinx",
170176
"-W", # Promote warnings to errors, so that misspelled words fail the build.
171-
"-b",
177+
"--builder",
172178
"spelling",
173-
"-d",
179+
"-c",
180+
"docs/",
181+
"--doctree-dir",
174182
f"{build_dir}/doctrees",
175-
".",
183+
"docs/",
176184
f"{build_dir}/html",
177185
# On Apple Silicon Macs, this environment variable needs to be set so
178186
# pyenchant can find the "enchant" C library. See
@@ -281,12 +289,12 @@ def lint_flake8(session: nox.Session) -> None:
281289
@nox.session(python=["3.12"], tags=["linters"])
282290
def lint_pylint(session: nox.Session) -> None:
283291
"""
284-
Lint code with Pyling.
292+
Lint code with Pylint.
285293
286294
"""
287295
# Pylint requires that all dependencies be importable during the run, so unlike
288296
# other lint tasks we just install the package.
289-
session.install(".")
297+
session.run_always("pdm", "install", "-dG", "tests", external=True)
290298
session.install("pylint", "pylint-django")
291299
session.run(f"python{session.python}", "-Im", "pylint", "--version")
292300
session.run(f"python{session.python}", "-Im", "pylint", "src/", "tests/")

0 commit comments

Comments
 (0)