99DOCS = ROOT / "docs"
1010TESTS = ROOT / "tests"
1111
12- REQUIREMENTS = dict (
13- docs = DOCS / "requirements.txt" ,
14- tests = TESTS / "requirements.txt" ,
15- )
16- REQUIREMENTS_IN = [ # this is actually ordered, as files depend on each other
17- (path .parent / f"{ path .stem } .in" , path ) for path in REQUIREMENTS .values ()
18- ]
19-
2012SUPPORTED = [
2113 "3.10" ,
2214 "3.11" ,
2921]
3022LATEST = SUPPORTED [- 1 ]
3123
32- nox .options .default_venv_backend = "uv|virtualenv "
24+ nox .options .default_venv_backend = "uv"
3325nox .options .sessions = []
3426
3527
@@ -52,12 +44,15 @@ def tests(session):
5244 # but it produces strange symbol errors saying:
5345 # dynamic module does not define module export function (PyInit_rpds)
5446 # so OK, dev it is.
55- session .install (
56- "--config-settings" ,
47+ session .run_install (
48+ "uv" ,
49+ "sync" ,
50+ "--group=test" ,
51+ "--config-setting" ,
5752 "build-args=--profile=dev" ,
5853 "--no-cache" ,
59- "-r " ,
60- REQUIREMENTS [ "tests" ] ,
54+ f"--python= { session . virtualenv . location } " ,
55+ env = { "UV_PROJECT_ENVIRONMENT" : session . virtualenv . location } ,
6156 )
6257
6358 if session .posargs and session .posargs [0 ] == "coverage" :
@@ -89,9 +84,15 @@ def build(session):
8984 """
9085 Build a distribution suitable for PyPI and check its validity.
9186 """
92- session .install ("build" , "twine" )
87+ session .install ("build[uv] " , "twine" )
9388 with TemporaryDirectory () as tmpdir :
94- session .run ("python" , "-m" , "build" , ROOT , "--outdir" , tmpdir )
89+ session .run (
90+ "pyproject-build" ,
91+ "--installer=uv" ,
92+ ROOT ,
93+ "--outdir" ,
94+ tmpdir ,
95+ )
9596 session .run ("twine" , "check" , "--strict" , tmpdir + "/*" )
9697
9798
@@ -109,7 +110,16 @@ def typing(session):
109110 """
110111 Check the codebase using pyright by type checking the test suite.
111112 """
112- session .install ("pyright" , ROOT , "-r" , REQUIREMENTS ["tests" ])
113+ session .run_install (
114+ "uv" ,
115+ "sync" ,
116+ "--group=typing" ,
117+ "--config-setting" ,
118+ "build-args=--profile=dev" ,
119+ "--no-cache" ,
120+ f"--python={ session .virtualenv .location } " ,
121+ env = {"UV_PROJECT_ENVIRONMENT" : session .virtualenv .location },
122+ )
113123 session .run ("pyright" , TESTS )
114124
115125
@@ -131,7 +141,16 @@ def docs(session, builder):
131141 """
132142 Build the documentation using a specific Sphinx builder.
133143 """
134- session .install ("-r" , REQUIREMENTS ["docs" ])
144+ session .run_install (
145+ "uv" ,
146+ "sync" ,
147+ "--group=docs" ,
148+ "--config-setting" ,
149+ "build-args=--profile=dev" ,
150+ "--no-cache" ,
151+ f"--python={ session .virtualenv .location } " ,
152+ env = {"UV_PROJECT_ENVIRONMENT" : session .virtualenv .location },
153+ )
135154 with TemporaryDirectory () as tmpdir_str :
136155 tmpdir = Path (tmpdir_str )
137156 argv = ["-n" , "-T" , "-W" ]
@@ -161,22 +180,3 @@ def docs_style(session):
161180 "pygments-github-lexers" ,
162181 )
163182 session .run ("python" , "-m" , "doc8" , "--config" , PYPROJECT , DOCS )
164-
165-
166- @session (default = False )
167- def requirements (session ):
168- """
169- Update the project's pinned requirements.
170-
171- You should commit the result afterwards.
172- """
173- if session .venv_backend == "uv" :
174- cmd = ["uv" , "pip" , "compile" ]
175- else :
176- session .install ("pip-tools" )
177- cmd = ["pip-compile" , "--resolver" , "backtracking" , "--strip-extras" ]
178-
179- for each , out in REQUIREMENTS_IN :
180- # otherwise output files end up with silly absolute path comments...
181- relative = each .relative_to (ROOT )
182- session .run (* cmd , "--upgrade" , "--output-file" , out , relative )
0 commit comments