Skip to content

Commit 02e1bfd

Browse files
committed
Add and ensure the noxfile gets documented.
1 parent 61e998c commit 02e1bfd

File tree

2 files changed

+28
-2
lines changed

2 files changed

+28
-2
lines changed

noxfile.py

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
nox.options.sessions = []
1414

1515

16-
def session(default=True, **kwargs):
16+
def session(default=True, **kwargs): # noqa: D103
1717
def _session(fn):
1818
if default:
1919
nox.options.sessions.append(kwargs.get("name", fn.__name__))
@@ -24,6 +24,9 @@ def _session(fn):
2424

2525
@session(python=["3.8", "3.9", "3.10", "3.11", "3.12", "pypy3"])
2626
def tests(session):
27+
"""
28+
Run the test suite with a corresponding Python version.
29+
"""
2730
session.install("-r", ROOT / "test-requirements.txt")
2831

2932
if session.posargs and session.posargs[0] == "coverage":
@@ -52,12 +55,18 @@ def tests(session):
5255

5356
@session()
5457
def audit(session):
58+
"""
59+
Audit dependencies for vulnerabilities.
60+
"""
5561
session.install("pip-audit", ROOT)
5662
session.run("python", "-m", "pip_audit")
5763

5864

5965
@session(tags=["build"])
6066
def build(session):
67+
"""
68+
Build a distribution suitable for PyPI and check its validity.
69+
"""
6170
session.install("build", "twine")
6271
with TemporaryDirectory() as tmpdir:
6372
session.run("python", "-m", "build", ROOT, "--outdir", tmpdir)
@@ -66,12 +75,18 @@ def build(session):
6675

6776
@session(tags=["style"])
6877
def style(session):
78+
"""
79+
Check Python code style.
80+
"""
6981
session.install("ruff")
7082
session.run("ruff", "check", ROOT)
7183

7284

7385
@session()
7486
def typing(session):
87+
"""
88+
Check static typing.
89+
"""
7590
session.install("pyright==1.1.307", ROOT)
7691
session.run("pyright", REFERENCING)
7792

@@ -91,6 +106,9 @@ def typing(session):
91106
],
92107
)
93108
def docs(session, builder):
109+
"""
110+
Build the documentation using a specific Sphinx builder.
111+
"""
94112
session.install("-r", DOCS / "requirements.txt")
95113
with TemporaryDirectory() as tmpdir_str:
96114
tmpdir = Path(tmpdir_str)
@@ -112,6 +130,9 @@ def docs(session, builder):
112130

113131
@session(tags=["docs", "style"], name="docs(style)")
114132
def docs_style(session):
133+
"""
134+
Check the documentation style.
135+
"""
115136
session.install(
116137
"doc8",
117138
"pygments",
@@ -122,6 +143,9 @@ def docs_style(session):
122143

123144
@session(default=False)
124145
def requirements(session):
146+
"""
147+
Update the project's pinned requirements. Commit the result.
148+
"""
125149
session.install("pip-tools")
126150
for each in [DOCS / "requirements.in", ROOT / "test-requirements.in"]:
127151
session.run(

pyproject.toml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,9 +70,11 @@ ignore = [
7070

7171
[tool.isort]
7272
combine_as_imports = true
73+
ensure_newline_before_comments = true
7374
from_first = true
7475
include_trailing_comma = true
7576
multi_line_output = 3
77+
use_parentheses = true
7678

7779
[tool.pyright]
7880
strict = ["**/*"]
@@ -122,4 +124,4 @@ docstring-quotes = "double"
122124
[tool.ruff.per-file-ignores]
123125
"docs/*" = ["ANN", "D"]
124126
"referencing/tests/*" = ["ANN", "D", "RUF012"]
125-
"noxfile.py" = ["ANN", "D"]
127+
"noxfile.py" = ["ANN", "D100"]

0 commit comments

Comments
 (0)