3nox.needs_version =
">=2022.1.7"
4nox.options.sessions = [
"lint",
"tests",
"tests_packaging"]
6PYTHON_VERSIONS = [
"2.7",
"3.5",
"3.6",
"3.7",
"3.8",
"3.9",
"3.10",
"3.11"]
9@nox.session(reuse_venv=True)
10def lint(session: nox.Session) ->
None:
12 Lint the codebase (except for clang-format/tidy).
14 session.install("pre-commit")
15 session.run(
"pre-commit",
"run",
"-a")
18@nox.session(python=PYTHON_VERSIONS)
19def tests(session: nox.Session) ->
None:
21 Run the tests (requires a compiler).
23 tmpdir = session.create_tmp()
24 session.install("cmake")
25 session.install(
"-r",
"tests/requirements.txt")
30 "-DPYBIND11_WERROR=ON",
31 "-DDOWNLOAD_CATCH=ON",
32 "-DDOWNLOAD_EIGEN=ON",
35 session.run(
"cmake",
"--build", tmpdir)
36 session.run(
"cmake",
"--build", tmpdir,
"--config=Release",
"--target",
"check")
42 Run the packaging tests.
45 session.install("-r",
"tests/requirements.txt",
"--prefer-binary")
46 session.run(
"pytest",
"tests/extra_python_package")
49@nox.session(reuse_venv=True)
50def docs(session: nox.Session) ->
None:
52 Build the docs. Pass "serve" to serve.
55 session.install("-r",
"docs/requirements.txt")
58 if "pdf" in session.posargs:
59 session.run(
"sphinx-build",
"-b",
"latexpdf",
".",
"_build")
62 session.run(
"sphinx-build",
"-b",
"html",
".",
"_build")
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")
68 session.error(
"Unsupported argument to docs")
71@nox.session(reuse_venv=True)
74 Inspect the closed issues and make entries
for a changelog.
76 session.install("ghapi",
"rich")
77 session.run(
"python",
"tools/make_changelog.py")
80@nox.session(reuse_venv=True)
81def build(session: nox.Session) ->
None:
83 Build SDists and wheels.
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)")
91 "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)