5nox.needs_version =
">=2022.1.7"
6nox.options.sessions = [
"lint",
"tests",
"tests_packaging"]
20if os.environ.get(
"CI",
None):
21 nox.options.error_on_missing_interpreters =
True
24@nox.session(reuse_venv=True)
25def lint(session: nox.Session) ->
None:
27 Lint the codebase (except for clang-format/tidy).
29 session.install("pre-commit")
30 session.run(
"pre-commit",
"run",
"-a", *session.posargs)
33@nox.session(python=PYTHON_VERSIONS)
34def tests(session: nox.Session) ->
None:
36 Run the tests (requires a compiler).
38 tmpdir = session.create_tmp()
39 session.install("cmake")
40 session.install(
"-r",
"tests/requirements.txt")
45 "-DPYBIND11_WERROR=ON",
46 "-DDOWNLOAD_CATCH=ON",
47 "-DDOWNLOAD_EIGEN=ON",
50 session.run(
"cmake",
"--build", tmpdir)
51 session.run(
"cmake",
"--build", tmpdir,
"--config=Release",
"--target",
"check")
57 Run the packaging tests.
60 session.install("-r",
"tests/requirements.txt",
"--prefer-binary")
61 session.run(
"pytest",
"tests/extra_python_package", *session.posargs)
64@nox.session(reuse_venv=True)
65def docs(session: nox.Session) ->
None:
67 Build the docs. Pass "serve" to serve.
70 session.install("-r",
"docs/requirements.txt")
73 if "pdf" in session.posargs:
74 session.run(
"sphinx-build",
"-M",
"latexpdf",
".",
"_build")
77 session.run(
"sphinx-build",
"-M",
"html",
".",
"_build")
79 if "serve" in session.posargs:
80 session.log(
"Launching docs at http://localhost:8000/ - use Ctrl-C to quit")
81 session.run(
"python",
"-m",
"http.server",
"8000",
"-d",
"_build/html")
83 session.error(
"Unsupported argument to docs")
86@nox.session(reuse_venv=True)
89 Inspect the closed issues and make entries
for a changelog.
91 session.install("ghapi",
"rich")
92 session.run(
"python",
"tools/make_changelog.py")
95@nox.session(reuse_venv=True)
96def build(session: nox.Session) ->
None:
98 Build SDists and wheels.
101 session.install("build")
102 session.log(
"Building normal files")
103 session.run(
"python",
"-m",
"build", *session.posargs)
104 session.log(
"Building pybind11-global files (PYBIND11_GLOBAL_SDIST=1)")
106 "python",
"-m",
"build", *session.posargs, env={
"PYBIND11_GLOBAL_SDIST":
"1"}
None tests_packaging(nox.Session session)
None tests(nox.Session session)
None build(nox.Session session)
None docs(nox.Session session)
None lint(nox.Session session)