Skip to content

Commit 7c45e0a

Browse files
committed
Use uv for envs, particularly the requirements env.
Faster, etc.
1 parent cc8c897 commit 7c45e0a

File tree

1 file changed

+12
-11
lines changed

1 file changed

+12
-11
lines changed

noxfile.py

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,13 @@
1212
tests=ROOT / "test-requirements.txt",
1313
)
1414
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()
1616
]
1717

1818
SUPPORTED = ["3.8", "3.9", "3.10", "pypy3.10", "3.11", "3.12"]
1919
LATEST = SUPPORTED[-1]
2020

21+
nox.options.default_venv_backend = "uv|virtualenv"
2122
nox.options.sessions = []
2223

2324

@@ -106,13 +107,13 @@ def requirements(session):
106107
107108
You should commit the result afterwards.
108109
"""
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

Comments
 (0)