13
13
nox .options .sessions = []
14
14
15
15
16
- def session (default = True , ** kwargs ):
16
+ def session (default = True , ** kwargs ): # noqa: D103
17
17
def _session (fn ):
18
18
if default :
19
19
nox .options .sessions .append (kwargs .get ("name" , fn .__name__ ))
@@ -24,6 +24,9 @@ def _session(fn):
24
24
25
25
@session (python = ["3.8" , "3.9" , "3.10" , "3.11" , "3.12" , "pypy3" ])
26
26
def tests (session ):
27
+ """
28
+ Run the test suite with a corresponding Python version.
29
+ """
27
30
session .install ("-r" , ROOT / "test-requirements.txt" )
28
31
29
32
if session .posargs and session .posargs [0 ] == "coverage" :
@@ -52,12 +55,18 @@ def tests(session):
52
55
53
56
@session ()
54
57
def audit (session ):
58
+ """
59
+ Audit dependencies for vulnerabilities.
60
+ """
55
61
session .install ("pip-audit" , ROOT )
56
62
session .run ("python" , "-m" , "pip_audit" )
57
63
58
64
59
65
@session (tags = ["build" ])
60
66
def build (session ):
67
+ """
68
+ Build a distribution suitable for PyPI and check its validity.
69
+ """
61
70
session .install ("build" , "twine" )
62
71
with TemporaryDirectory () as tmpdir :
63
72
session .run ("python" , "-m" , "build" , ROOT , "--outdir" , tmpdir )
@@ -66,12 +75,18 @@ def build(session):
66
75
67
76
@session (tags = ["style" ])
68
77
def style (session ):
78
+ """
79
+ Check Python code style.
80
+ """
69
81
session .install ("ruff" )
70
82
session .run ("ruff" , "check" , ROOT )
71
83
72
84
73
85
@session ()
74
86
def typing (session ):
87
+ """
88
+ Check static typing.
89
+ """
75
90
session .install ("pyright==1.1.307" , ROOT )
76
91
session .run ("pyright" , REFERENCING )
77
92
@@ -91,6 +106,9 @@ def typing(session):
91
106
],
92
107
)
93
108
def docs (session , builder ):
109
+ """
110
+ Build the documentation using a specific Sphinx builder.
111
+ """
94
112
session .install ("-r" , DOCS / "requirements.txt" )
95
113
with TemporaryDirectory () as tmpdir_str :
96
114
tmpdir = Path (tmpdir_str )
@@ -112,6 +130,9 @@ def docs(session, builder):
112
130
113
131
@session (tags = ["docs" , "style" ], name = "docs(style)" )
114
132
def docs_style (session ):
133
+ """
134
+ Check the documentation style.
135
+ """
115
136
session .install (
116
137
"doc8" ,
117
138
"pygments" ,
@@ -122,6 +143,9 @@ def docs_style(session):
122
143
123
144
@session (default = False )
124
145
def requirements (session ):
146
+ """
147
+ Update the project's pinned requirements. Commit the result.
148
+ """
125
149
session .install ("pip-tools" )
126
150
for each in [DOCS / "requirements.in" , ROOT / "test-requirements.in" ]:
127
151
session .run (
0 commit comments