1 from __future__
import annotations
7 nox.needs_version =
">=2024.3.2"
8 nox.options.sessions = [
"lint",
"tests",
"tests_packaging"]
9 nox.options.default_venv_backend =
"uv|virtualenv"
12 @nox.session(reuse_venv=
True)
13 def lint(session: nox.Session) ->
None:
15 Lint the codebase (except for clang-format/tidy).
17 session.install(
"pre-commit")
18 session.run(
"pre-commit",
"run",
"-a", *session.posargs)
22 def tests(session: nox.Session) ->
None:
24 Run the tests (requires a compiler).
26 tmpdir = session.create_tmp()
27 session.install(
"cmake")
28 session.install(
"-r",
"tests/requirements.txt")
33 "-DPYBIND11_WERROR=ON",
34 "-DDOWNLOAD_CATCH=ON",
35 "-DDOWNLOAD_EIGEN=ON",
38 session.run(
"cmake",
"--build", tmpdir)
39 session.run(
"cmake",
"--build", tmpdir,
"--config=Release",
"--target",
"check")
45 Run the packaging tests.
48 session.install(
"-r",
"tests/requirements.txt",
"pip")
49 session.run(
"pytest",
"tests/extra_python_package", *session.posargs)
52 @nox.session(reuse_venv=
True)
53 def docs(session: nox.Session) ->
None:
55 Build the docs. Pass --non-interactive to avoid serving.
58 parser = argparse.ArgumentParser()
60 "-b", dest=
"builder", default=
"html", help=
"Build target (default: html)"
62 args, posargs = parser.parse_known_args(session.posargs)
63 serve = args.builder ==
"html" and session.interactive
65 extra_installs = [
"sphinx-autobuild"]
if serve
else []
66 session.install(
"-r",
"docs/requirements.txt", *extra_installs)
74 f
"_build/{args.builder}",
80 "sphinx-autobuild",
"--open-browser",
"--ignore=.build", *shared_args
83 session.run(
"sphinx-build",
"--keep-going", *shared_args)
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)
96 def 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"}