3333nox .options .sessions = []
3434
3535
36- def session (default = True , ** kwargs ):
36+ def session (default = True , ** kwargs ): # noqa: D103
3737 def _session (fn ):
3838 if default :
3939 nox .options .sessions .append (kwargs .get ("name" , fn .__name__ ))
@@ -45,7 +45,9 @@ def _session(fn):
4545@session (python = ["3.8" , "3.9" , "3.10" , "3.11" , "3.12" , "pypy3" ])
4646@nox .parametrize ("installable" , INSTALLABLE )
4747def tests (session , installable ):
48-
48+ """
49+ Run the test suite with a corresponding Python version.
50+ """
4951 env = dict (JSON_SCHEMA_TEST_SUITE = str (ROOT / "json" ))
5052
5153 session .install ("virtue" , installable )
@@ -87,6 +89,9 @@ def tests(session, installable):
8789@session ()
8890@nox .parametrize ("installable" , INSTALLABLE )
8991def audit (session , installable ):
92+ """
93+ Audit dependencies for vulnerabilities.
94+ """
9095 session .install ("pip-audit" , installable )
9196 session .run ("python" , "-m" , "pip_audit" )
9297
@@ -107,6 +112,9 @@ def audit(session, installable):
107112
108113@session (tags = ["build" ])
109114def build (session ):
115+ """
116+ Build a distribution suitable for PyPI and check its validity.
117+ """
110118 session .install ("build" , "docutils" , "twine" )
111119 with TemporaryDirectory () as tmpdir :
112120 session .run ("python" , "-m" , "build" , ROOT , "--outdir" , tmpdir )
@@ -118,18 +126,27 @@ def build(session):
118126
119127@session ()
120128def secrets (session ):
129+ """
130+ Check for accidentally committed secrets.
131+ """
121132 session .install ("detect-secrets" )
122133 session .run ("detect-secrets" , "scan" , ROOT )
123134
124135
125136@session (tags = ["style" ])
126137def style (session ):
138+ """
139+ Check Python code style.
140+ """
127141 session .install ("ruff" )
128142 session .run ("ruff" , "check" , ROOT )
129143
130144
131145@session ()
132146def typing (session ):
147+ """
148+ Check static typing.
149+ """
133150 session .install ("mypy" , "types-requests" , ROOT )
134151 session .run ("mypy" , "--config" , PYPROJECT , PACKAGE )
135152
@@ -149,6 +166,9 @@ def typing(session):
149166 ],
150167)
151168def docs (session , builder ):
169+ """
170+ Build the documentation using a specific Sphinx builder.
171+ """
152172 session .install ("-r" , DOCS / "requirements.txt" )
153173 with TemporaryDirectory () as tmpdir_str :
154174 tmpdir = Path (tmpdir_str )
@@ -170,6 +190,9 @@ def docs(session, builder):
170190
171191@session (tags = ["docs" , "style" ], name = "docs(style)" )
172192def docs_style (session ):
193+ """
194+ Check the documentation style.
195+ """
173196 session .install (
174197 "doc8" ,
175198 "pygments" ,
@@ -178,12 +201,6 @@ def docs_style(session):
178201 session .run ("python" , "-m" , "doc8" , "--config" , PYPROJECT , DOCS )
179202
180203
181- @session (default = False )
182- def bandit (session ):
183- session .install ("bandit" )
184- session .run ("bandit" , "--recursive" , PACKAGE )
185-
186-
187204@session (default = False )
188205@nox .parametrize (
189206 "benchmark" ,
@@ -193,6 +210,9 @@ def bandit(session):
193210 ],
194211)
195212def perf (session , benchmark ):
213+ """
214+ Run a performance benchmark.
215+ """
196216 session .install ("pyperf" , f"{ ROOT } [format]" )
197217 tmpdir = Path (session .create_tmp ())
198218 output = tmpdir / f"bench-{ benchmark } .json"
@@ -201,6 +221,11 @@ def perf(session, benchmark):
201221
202222@session (default = False )
203223def requirements (session ):
224+ """
225+ Update the project's pinned requirements.
226+
227+ You should commit the result afterwards.
228+ """
204229 session .install ("pip-tools" )
205230 for each in [DOCS / "requirements.in" ]:
206231 session .run (
0 commit comments