5 nox.needs_version =
">=2022.1.7" 6 nox.options.sessions = [
"lint",
"tests",
"tests_packaging"]
8 PYTHON_VERISONS = [
"3.6",
"3.7",
"3.8",
"3.9",
"3.10",
"3.11",
"pypy3.7",
"pypy3.8"]
10 if os.environ.get(
"CI",
None):
11 nox.options.error_on_missing_interpreters =
True 14 @nox.session(reuse_venv=
True)
15 def lint(session: nox.Session) ->
None:
17 Lint the codebase (except for clang-format/tidy). 19 session.install(
"pre-commit")
20 session.run(
"pre-commit",
"run",
"-a")
23 @nox.session(python=PYTHON_VERISONS)
24 def tests(session: nox.Session) ->
None:
26 Run the tests (requires a compiler). 28 tmpdir = session.create_tmp()
29 session.install(
"cmake")
30 session.install(
"-r",
"tests/requirements.txt")
35 "-DPYBIND11_WERROR=ON",
36 "-DDOWNLOAD_CATCH=ON",
37 "-DDOWNLOAD_EIGEN=ON",
40 session.run(
"cmake",
"--build", tmpdir)
41 session.run(
"cmake",
"--build", tmpdir,
"--config=Release",
"--target",
"check")
47 Run the packaging tests. 50 session.install(
"-r",
"tests/requirements.txt",
"--prefer-binary")
51 session.run(
"pytest",
"tests/extra_python_package")
54 @nox.session(reuse_venv=
True)
55 def docs(session: nox.Session) ->
None:
57 Build the docs. Pass "serve" to serve. 60 session.install(
"-r",
"docs/requirements.txt")
63 if "pdf" in session.posargs:
64 session.run(
"sphinx-build",
"-M",
"latexpdf",
".",
"_build")
67 session.run(
"sphinx-build",
"-M",
"html",
".",
"_build")
69 if "serve" in session.posargs:
70 session.log(
"Launching docs at http://localhost:8000/ - use Ctrl-C to quit")
71 session.run(
"python",
"-m",
"http.server",
"8000",
"-d",
"_build/html")
73 session.error(
"Unsupported argument to docs")
76 @nox.session(reuse_venv=
True)
79 Inspect the closed issues and make entries for a changelog. 81 session.install(
"ghapi",
"rich")
82 session.run(
"python",
"tools/make_changelog.py")
85 @nox.session(reuse_venv=
True)
86 def build(session: nox.Session) ->
None:
88 Build SDists and wheels. 91 session.install(
"build")
92 session.log(
"Building normal files")
93 session.run(
"python",
"-m",
"build", *session.posargs)
94 session.log(
"Building pybind11-global files (PYBIND11_GLOBAL_SDIST=1)")
96 "python",
"-m",
"build", *session.posargs, env={
"PYBIND11_GLOBAL_SDIST":
"1"}