|
22 | 22 | docs=DOCS / "requirements.txt", |
23 | 23 | ) |
24 | 24 | REQUIREMENTS_IN = [ # this is actually ordered, as files depend on each other |
25 | | - path.parent / f"{path.stem}.in" for path in REQUIREMENTS.values() |
| 25 | + (path.parent / f"{path.stem}.in", path) for path in REQUIREMENTS.values() |
26 | 26 | ] |
27 | 27 |
|
28 | 28 | NONGPL_LICENSES = [ |
|
38 | 38 | SUPPORTED = ["3.9", "3.10", "pypy3.10", "3.11", "3.12", "3.13"] |
39 | 39 | LATEST_STABLE = SUPPORTED[-1] |
40 | 40 |
|
| 41 | +nox.options.default_venv_backend = "uv|virtualenv" |
41 | 42 | nox.options.sessions = [] |
42 | 43 |
|
43 | 44 |
|
@@ -136,9 +137,15 @@ def build(session): |
136 | 137 | """ |
137 | 138 | Build a distribution suitable for PyPI and check its validity. |
138 | 139 | """ |
139 | | - session.install("build", "docutils", "twine") |
| 140 | + session.install("build[uv]", "docutils", "twine") |
140 | 141 | with TemporaryDirectory() as tmpdir: |
141 | | - session.run("python", "-m", "build", ROOT, "--outdir", tmpdir) |
| 142 | + session.run( |
| 143 | + "pyproject-build", |
| 144 | + "--installer=uv", |
| 145 | + ROOT, |
| 146 | + "--outdir", |
| 147 | + tmpdir, |
| 148 | + ) |
142 | 149 | session.run("twine", "check", "--strict", tmpdir + "/*") |
143 | 150 | session.run( |
144 | 151 | "python", "-m", "docutils", "--strict", CHANGELOG, os.devnull, |
@@ -247,13 +254,13 @@ def requirements(session): |
247 | 254 |
|
248 | 255 | You should commit the result afterwards. |
249 | 256 | """ |
250 | | - session.install("pip-tools") |
251 | | - for each in REQUIREMENTS_IN: |
252 | | - session.run( |
253 | | - "pip-compile", |
254 | | - "--resolver", |
255 | | - "backtracking", |
256 | | - "--strip-extras", |
257 | | - "-U", |
258 | | - each.relative_to(ROOT), |
259 | | - ) |
| 257 | + if session.venv_backend == "uv": |
| 258 | + cmd = ["uv", "pip", "compile"] |
| 259 | + else: |
| 260 | + session.install("pip-tools") |
| 261 | + cmd = ["pip-compile", "--resolver", "backtracking", "--strip-extras"] |
| 262 | + |
| 263 | + for each, out in REQUIREMENTS_IN: |
| 264 | + # otherwise output files end up with silly absolute path comments... |
| 265 | + relative = each.relative_to(ROOT) |
| 266 | + session.run(*cmd, "--upgrade", "--output-file", out, relative) |
0 commit comments