1414 docs = DOCS / "requirements.txt" ,
1515 tests = ROOT / "test-requirements.txt" ,
1616)
17- REQUIREMENTS_IN = {
18- path .parent / f"{ path .stem } .in" for path in REQUIREMENTS .values ()
19- }
17+ REQUIREMENTS_IN = [ # this is actually ordered, as files depend on each other
18+ ( path .parent / f"{ path .stem } .in" , path ) for path in REQUIREMENTS .values ()
19+ ]
2020
21-
22- SUPPORTED = ["pypy3.10" , "3.10" , "3.11" , "3.12" ]
21+ SUPPORTED = ["pypy3.10" , "3.10" , "3.11" , "3.12" , "3.13" ]
2322LATEST = SUPPORTED [- 1 ]
2423
24+ nox .options .default_venv_backend = "uv|virtualenv"
2525nox .options .sessions = []
2626
2727
@@ -37,7 +37,7 @@ def _session(fn):
3737@session (python = SUPPORTED )
3838def tests (session ):
3939 """
40- Run the test suite.
40+ Run the test suite with a corresponding Python version .
4141 """
4242 session .install ("-r" , REQUIREMENTS ["tests" ])
4343
@@ -65,7 +65,7 @@ def tests(session):
6565 session .run ("python" , "-m" , "pytest" , * session .posargs , PACKAGE )
6666
6767
68- @session (python = SUPPORTED )
68+ @session ()
6969def audit (session ):
7070 """
7171 Audit Python dependencies for vulnerabilities.
@@ -79,9 +79,15 @@ def build(session):
7979 """
8080 Build a distribution suitable for PyPI and check its validity.
8181 """
82- session .install ("build" , "twine" )
82+ session .install ("build[uv] " , "twine" )
8383 with TemporaryDirectory () as tmpdir :
84- session .run ("python" , "-m" , "build" , ROOT , "--outdir" , tmpdir )
84+ session .run (
85+ "pyproject-build" ,
86+ "--installer=uv" ,
87+ ROOT ,
88+ "--outdir" ,
89+ tmpdir ,
90+ )
8591 session .run ("twine" , "check" , "--strict" , tmpdir + "/*" )
8692
8793
@@ -97,7 +103,7 @@ def secrets(session):
97103@session (tags = ["style" ])
98104def style (session ):
99105 """
100- Check for coding style.
106+ Check Python code style.
101107 """
102108 session .install ("ruff" )
103109 session .run ("ruff" , "check" , ROOT )
@@ -106,10 +112,10 @@ def style(session):
106112@session ()
107113def typing (session ):
108114 """
109- Statically check typing annotations .
115+ Check static typing.
110116 """
111117 session .install ("pyright" , ROOT )
112- session .run ("pyright" , PACKAGE )
118+ session .run ("pyright" , * session . posargs , PACKAGE )
113119
114120
115121@session (tags = ["docs" ])
@@ -128,9 +134,9 @@ def typing(session):
128134)
129135def docs (session , builder ):
130136 """
131- Build the documentation using various Sphinx builders .
137+ Build the documentation using a specific Sphinx builder .
132138 """
133- session .install ("-r" , DOCS / "requirements.txt" )
139+ session .install ("-r" , REQUIREMENTS [ "docs" ] )
134140 with TemporaryDirectory () as tmpdir_str :
135141 tmpdir = Path (tmpdir_str )
136142 argv = ["-n" , "-T" , "-W" ]
@@ -152,7 +158,7 @@ def docs(session, builder):
152158@session (tags = ["docs" , "style" ], name = "docs(style)" )
153159def docs_style (session ):
154160 """
155- Check the documentation source style.
161+ Check the documentation style.
156162 """
157163 session .install (
158164 "doc8" ,
@@ -165,15 +171,17 @@ def docs_style(session):
165171@session (default = False )
166172def requirements (session ):
167173 """
168- Update requirements files.
174+ Update the project's pinned requirements.
175+
176+ You should commit the result afterwards.
169177 """
170- session .install ( "pip-tools" )
171- for each in REQUIREMENTS_IN :
172- session . run (
173- "pip-compile" ,
174- "--resolver" ,
175- "backtracking" ,
176- "--strip-extras" ,
177- "-U" ,
178- each .relative_to (ROOT ),
179- )
178+ if session .venv_backend == "uv" :
179+ cmd = [ "uv" , "pip" , "compile" ]
180+ else :
181+ session . install ( "pip-tools" )
182+ cmd = [ "pip-compile" , "--resolver" , "backtracking" , "--strip-extras" ]
183+
184+ for each , out in REQUIREMENTS_IN :
185+ # otherwise output files end up with silly absolute path comments...
186+ relative = each .relative_to (ROOT )
187+ session . run ( * cmd , "--upgrade" , "--output-file" , out , relative )
0 commit comments