μHAL (v2.8.17)
Part of the IPbus software repository
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
noxfile.py
Go to the documentation of this file.
1import nox
2
3nox.needs_version = ">=2022.1.7"
4nox.options.sessions = ["lint", "tests", "tests_packaging"]
5
6PYTHON_VERSIONS = ["2.7", "3.5", "3.6", "3.7", "3.8", "3.9", "3.10", "3.11"]
7
8
9@nox.session(reuse_venv=True)
10def lint(session: nox.Session) -> None:
11 """
12 Lint the codebase (except for clang-format/tidy).
13 """
14 session.install("pre-commit")
15 session.run("pre-commit", "run", "-a")
16
17
18@nox.session(python=PYTHON_VERSIONS)
19def tests(session: nox.Session) -> None:
20 """
21 Run the tests (requires a compiler).
22 """
23 tmpdir = session.create_tmp()
24 session.install("cmake")
25 session.install("-r", "tests/requirements.txt")
26 session.run(
27 "cmake",
28 "-S.",
29 f"-B{tmpdir}",
30 "-DPYBIND11_WERROR=ON",
31 "-DDOWNLOAD_CATCH=ON",
32 "-DDOWNLOAD_EIGEN=ON",
33 *session.posargs,
34 )
35 session.run("cmake", "--build", tmpdir)
36 session.run("cmake", "--build", tmpdir, "--config=Release", "--target", "check")
37
38
39@nox.session
40def tests_packaging(session: nox.Session) -> None:
41 """
42 Run the packaging tests.
43 """
44
45 session.install("-r", "tests/requirements.txt", "--prefer-binary")
46 session.run("pytest", "tests/extra_python_package")
47
48
49@nox.session(reuse_venv=True)
50def docs(session: nox.Session) -> None:
51 """
52 Build the docs. Pass "serve" to serve.
53 """
54
55 session.install("-r", "docs/requirements.txt")
56 session.chdir("docs")
57
58 if "pdf" in session.posargs:
59 session.run("sphinx-build", "-b", "latexpdf", ".", "_build")
60 return
61
62 session.run("sphinx-build", "-b", "html", ".", "_build")
63
64 if "serve" in session.posargs:
65 session.log("Launching docs at http://localhost:8000/ - use Ctrl-C to quit")
66 session.run("python", "-m", "http.server", "8000", "-d", "_build/html")
67 elif session.posargs:
68 session.error("Unsupported argument to docs")
69
70
71@nox.session(reuse_venv=True)
72def make_changelog(session: nox.Session) -> None:
73 """
74 Inspect the closed issues and make entries for a changelog.
75 """
76 session.install("ghapi", "rich")
77 session.run("python", "tools/make_changelog.py")
78
79
80@nox.session(reuse_venv=True)
81def build(session: nox.Session) -> None:
82 """
83 Build SDists and wheels.
84 """
85
86 session.install("build")
87 session.log("Building normal files")
88 session.run("python", "-m", "build", *session.posargs)
89 session.log("Building pybind11-global files (PYBIND11_GLOBAL_SDIST=1)")
90 session.run(
91 "python", "-m", "build", *session.posargs, env={"PYBIND11_GLOBAL_SDIST": "1"}
92 )
None tests_packaging(nox.Session session)
Definition: noxfile.py:40
None tests(nox.Session session)
Definition: noxfile.py:19
None build(nox.Session session)
Definition: noxfile.py:81
None docs(nox.Session session)
Definition: noxfile.py:50
None lint(nox.Session session)
Definition: noxfile.py:10