-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnoxfile.py
54 lines (39 loc) · 1.57 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
44
45
46
47
48
49
50
51
52
53
54
import nox
python_version = "3.12"
nox.options.sessions = ["lint", "test"]
# nox.options.default_venv_backend = "uv"
# nox.options.reuse_venv = True
@nox.session(reuse_venv=True)
def lint(session):
session.install("ruff")
session.run("ruff", "check", "tests")
session.run("ruff", "format", "tests")
@nox.session(python=python_version, reuse_venv=True)
def test(session):
requirements = nox.project.load_toml("pyproject.toml")["project"]["dependencies"]
if requirements:
session.install(*requirements)
session.install(".")
session.install("pytest")
session.run("pytest", "tests")
@nox.session(name="test-cov", python=python_version, reuse_venv=True)
def test_cov(session):
requirements = nox.project.load_toml("pyproject.toml")["project"]["dependencies"]
if requirements:
session.install(*requirements)
session.install(".")
session.install("pytest", "pytest-cov")
session.run("pytest", "--cov", "--cov-report=xml")
build_command = ["-b", "html", "docs", "docs/_build/html", "-v"]
@nox.session(python=python_version, reuse_venv=True)
def docs(session):
session.install("-r", "docs/doc_requirements.txt")
session.run("sphinx-build", *build_command)
@nox.session(name="docs-live", python=python_version, reuse_venv=True)
def docs_live(session):
session.install("-r", "docs/doc_requirements.txt")
session.install("sphinx-autobuild")
AUTOBUILD_IGNORE = ["docs/_build"]
cmd = ["--ignore"] + [f"*/{folder}/*" for folder in AUTOBUILD_IGNORE]
cmd.extend(build_command)
session.run("sphinx-autobuild", *cmd)