-
Notifications
You must be signed in to change notification settings - Fork 8
/
noxfile.py
43 lines (34 loc) · 1.03 KB
/
noxfile.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
import os
from pathlib import Path
import nox
@nox.session
def build(session: nox.Session):
session.install(
"-r",
"tests/requirements.in",
"-c",
"tests/requirements.txt",
)
session.run("python", "-I", "-m", "mkdocs", "build", *session.posargs)
requirements_files = list(
{path.name.replace(".in", "") for path in Path("tests").glob("*in")}
- {"constraints", "constraints-base"}
)
@nox.session(name="pip-compile", python=["3.11"])
@nox.parametrize(["req"], requirements_files, requirements_files)
def pip_compile(session: nox.Session, req: str):
# .pip-tools.toml was introduced in v7
session.install("pip-tools >= 7")
# Use --upgrade by default unless a user passes -P.
args = list(session.posargs)
if not any(
arg.startswith(("-P", "--upgrade-package", "--no-upgrade")) for arg in args
):
args.append("--upgrade")
session.run(
"pip-compile",
"--output-file",
f"tests/{req}.txt",
*args,
f"tests/{req}.in",
)