Skip to content

Commit ae9b366

Browse files
committed
Rework CI/RTD dependencies.
As noted in comments, doing these as etxras or as PDM dev dependencies doens't really work because they're not used like extras, and PDM would constrain them to Python-3.9-compatible versions, which creates differences with RTD (which runs a much newer Python and will pick up, for example, Sphinx 8.x instead of 7.x as a result).
1 parent dc00718 commit ae9b366

File tree

8 files changed

+50
-1076
lines changed

8 files changed

+50
-1076
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ jobs:
119119
- run: tar xf dist/*.tar.gz --strip-components=1
120120
- uses: actions/setup-python@v5
121121
with:
122-
python-version: "3.13"
122+
python-version: "3.12"
123123
- name: Set up test runner
124124
run: |
125125
python -VV

.pre-commit-config.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# See https://pre-commit.com/hooks.html for more hooks
33
repos:
44
- repo: https://github.com/pre-commit/pre-commit-hooks
5-
rev: v4.6.0
5+
rev: v5.0.0
66
hooks:
77
- id: check-added-large-files
88
- id: check-ast
@@ -16,10 +16,10 @@ repos:
1616
- id: end-of-file-fixer
1717
- id: trailing-whitespace
1818
- repo: https://github.com/psf/black
19-
rev: 24.8.0
19+
rev: 24.10.0
2020
hooks:
2121
- id: black
22-
language_version: python3.8
22+
language_version: python3.13
2323
name: black (Python formatter)
2424
- repo: https://github.com/pycqa/flake8
2525
rev: 7.1.1

.readthedocs.yaml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,13 @@ version: 2
77
build:
88
os: ubuntu-22.04
99
tools:
10-
python: "3.11"
10+
python: "3.12"
1111

1212
sphinx:
1313
configuration: docs/conf.py
1414

1515
python:
1616
install:
1717
- method: pip
18-
path: .[docs]
18+
path: .
19+
- requirements: docs/requirements.txt

docs/conf.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
"sphinx_inline_tabs",
3636
]
3737
templates_path = ["_templates"]
38-
source_suffix = ".rst"
38+
source_suffix = {".rst": "restructuredtext"}
3939
master_doc = "index"
4040
project = "django-registration"
4141
copyright = "James Bennett and contributors"

docs/requirements.txt

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# These dependencies are not "extras" defined in the pyproject.toml,
2+
# because they're not something you actually want to install alongside
3+
# the main package. They're also not "dev dependencies" in the PDM
4+
# sense of the term, because PDM would constrain them to the oldest
5+
# Python version the main package supports (3.9), while all our
6+
# documentation jobs, whether run via nox or via readthedocs, run on
7+
# Python 3.12.
8+
furo
9+
sphinx
10+
sphinx-copybutton
11+
sphinx-inline-tabs
12+
sphinx-notfound-page
13+
sphinxext-opengraph

noxfile.py

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,12 @@ def tests_with_coverage(session: nox.Session, django: str) -> None:
7676
Run the package's unit tests, with coverage report.
7777
7878
"""
79-
session.install(f"Django~={django}.0", ".[tests]")
79+
session.install(
80+
f"Django~={django}.0",
81+
".[tests]",
82+
"coverage",
83+
'tomli; python_full_version < "3.11.0a7"',
84+
)
8085
python_version = session.run(
8186
f"{session.bin}/python{session.python}", "--version", silent=True
8287
).strip()
@@ -127,13 +132,17 @@ def coverage_report(session: nox.Session) -> None:
127132
# -----------------------------------------------------------------------------------
128133

129134

130-
@nox.session(python=["3.13"], tags=["docs"])
135+
# The documentation jobs ordinarily would want to use the latest Python version, but
136+
# currently that's 3.13 and Read The Docs doesn't yet support it. So to ensure the
137+
# documentation jobs are as closely matched to what would happen on RTD, these jobs stay
138+
# on 3.12 for now.
139+
@nox.session(python=["3.12"], tags=["docs"])
131140
def docs_build(session: nox.Session) -> None:
132141
"""
133142
Build the package's documentation as HTML.
134143
135144
"""
136-
session.install(".[docs]")
145+
session.install(".", "-r", "docs/requirements.txt")
137146
build_dir = session.create_tmp()
138147
session.run(
139148
f"{session.bin}/python{session.python}",
@@ -152,7 +161,7 @@ def docs_build(session: nox.Session) -> None:
152161
clean()
153162

154163

155-
@nox.session(python=["3.13"], tags=["docs"])
164+
@nox.session(python=["3.12"], tags=["docs"])
156165
def docs_docstrings(session: nox.Session) -> None:
157166
"""
158167
Enforce the presence of docstrings on all modules, classes, functions, and
@@ -175,13 +184,13 @@ def docs_docstrings(session: nox.Session) -> None:
175184
clean()
176185

177186

178-
@nox.session(python=["3.13"], tags=["docs"])
187+
@nox.session(python=["3.12"], tags=["docs"])
179188
def docs_spellcheck(session: nox.Session) -> None:
180189
"""
181190
Spell-check the package's documentation.
182191
183192
"""
184-
session.install(".[docs]")
193+
session.install(".", "-r", "docs/requirements.txt")
185194
session.install("pyenchant", "sphinxcontrib-spelling")
186195
build_dir = session.create_tmp()
187196
session.run(

pdm.lock

Lines changed: 11 additions & 1039 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pyproject.toml

Lines changed: 3 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -41,30 +41,6 @@ dependencies = [
4141
"Documentation" = "https://django-registration.readthedocs.io/"
4242
"Source Code" = "https://github.com/ubernostrum/django-registration"
4343

44-
45-
[project.optional-dependencies]
46-
docs = [
47-
"furo",
48-
"sphinx",
49-
"sphinx-copybutton",
50-
"sphinx-inline-tabs",
51-
"sphinx-notfound-page",
52-
"sphinxext-opengraph",
53-
]
54-
linters = [
55-
"bandit[toml]",
56-
"flake8",
57-
"flake8-bugbear",
58-
"pylint",
59-
"pylint-django",
60-
"interrogate",
61-
]
62-
tests = [
63-
"coverage",
64-
"nox",
65-
"tomli; python_full_version < \"3.11.0a7\"",
66-
]
67-
6844
[tool.bandit]
6945
exclude_dirs = ["src/django_registration/_backports.py"]
7046
skips = ["B101"]
@@ -137,3 +113,6 @@ disable = [
137113
"missing-module-docstring",
138114
"too-many-ancestors",
139115
]
116+
117+
[dependency-groups]
118+
tests = ["nox"]

0 commit comments

Comments
 (0)