|
12 | 12 | tests=ROOT / "test-requirements.txt",
|
13 | 13 | )
|
14 | 14 | REQUIREMENTS_IN = [ # this is actually ordered, as files depend on each other
|
15 |
| - path.parent / f"{path.stem}.in" for path in REQUIREMENTS.values() |
| 15 | + (path.parent / f"{path.stem}.in", path) for path in REQUIREMENTS.values() |
16 | 16 | ]
|
17 | 17 |
|
18 | 18 | SUPPORTED = ["3.8", "3.9", "3.10", "pypy3.10", "3.11", "3.12"]
|
19 | 19 | LATEST = SUPPORTED[-1]
|
20 | 20 |
|
| 21 | +nox.options.default_venv_backend = "uv|virtualenv" |
21 | 22 | nox.options.sessions = []
|
22 | 23 |
|
23 | 24 |
|
@@ -106,13 +107,13 @@ def requirements(session):
|
106 | 107 |
|
107 | 108 | You should commit the result afterwards.
|
108 | 109 | """
|
109 |
| - session.install("pip-tools") |
110 |
| - for each in REQUIREMENTS_IN: |
111 |
| - session.run( |
112 |
| - "pip-compile", |
113 |
| - "--resolver", |
114 |
| - "backtracking", |
115 |
| - "--strip-extras", |
116 |
| - "-U", |
117 |
| - each.relative_to(ROOT), |
118 |
| - ) |
| 110 | + if session.venv_backend == "uv": |
| 111 | + cmd = ["uv", "pip", "compile"] |
| 112 | + else: |
| 113 | + session.install("pip-tools") |
| 114 | + cmd = ["pip-compile", "--resolver", "backtracking", "--strip-extras"] |
| 115 | + |
| 116 | + for each, out in REQUIREMENTS_IN: |
| 117 | + # otherwise output files end up with silly absolute path comments... |
| 118 | + relative = each.relative_to(ROOT) |
| 119 | + session.run(*cmd, "--upgrade", "--output-file", out, relative) |
0 commit comments