noxfile.py
Go to the documentation of this file.
1 import os
2 
3 import nox
4 
5 nox.needs_version = ">=2022.1.7"
6 nox.options.sessions = ["lint", "tests", "tests_packaging"]
7 
8 PYTHON_VERISONS = ["3.6", "3.7", "3.8", "3.9", "3.10", "3.11", "pypy3.7", "pypy3.8"]
9 
10 if os.environ.get("CI", None):
11  nox.options.error_on_missing_interpreters = True
12 
13 
14 @nox.session(reuse_venv=True)
15 def lint(session: nox.Session) -> None:
16  """
17  Lint the codebase (except for clang-format/tidy).
18  """
19  session.install("pre-commit")
20  session.run("pre-commit", "run", "-a")
21 
22 
23 @nox.session(python=PYTHON_VERISONS)
24 def tests(session: nox.Session) -> None:
25  """
26  Run the tests (requires a compiler).
27  """
28  tmpdir = session.create_tmp()
29  session.install("cmake")
30  session.install("-r", "tests/requirements.txt")
31  session.run(
32  "cmake",
33  "-S.",
34  f"-B{tmpdir}",
35  "-DPYBIND11_WERROR=ON",
36  "-DDOWNLOAD_CATCH=ON",
37  "-DDOWNLOAD_EIGEN=ON",
38  *session.posargs,
39  )
40  session.run("cmake", "--build", tmpdir)
41  session.run("cmake", "--build", tmpdir, "--config=Release", "--target", "check")
42 
43 
44 @nox.session
45 def tests_packaging(session: nox.Session) -> None:
46  """
47  Run the packaging tests.
48  """
49 
50  session.install("-r", "tests/requirements.txt", "--prefer-binary")
51  session.run("pytest", "tests/extra_python_package")
52 
53 
54 @nox.session(reuse_venv=True)
55 def docs(session: nox.Session) -> None:
56  """
57  Build the docs. Pass "serve" to serve.
58  """
59 
60  session.install("-r", "docs/requirements.txt")
61  session.chdir("docs")
62 
63  if "pdf" in session.posargs:
64  session.run("sphinx-build", "-M", "latexpdf", ".", "_build")
65  return
66 
67  session.run("sphinx-build", "-M", "html", ".", "_build")
68 
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")
72  elif session.posargs:
73  session.error("Unsupported argument to docs")
74 
75 
76 @nox.session(reuse_venv=True)
77 def make_changelog(session: nox.Session) -> None:
78  """
79  Inspect the closed issues and make entries for a changelog.
80  """
81  session.install("ghapi", "rich")
82  session.run("python", "tools/make_changelog.py")
83 
84 
85 @nox.session(reuse_venv=True)
86 def build(session: nox.Session) -> None:
87  """
88  Build SDists and wheels.
89  """
90 
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)")
95  session.run(
96  "python", "-m", "build", *session.posargs, env={"PYBIND11_GLOBAL_SDIST": "1"}
97  )
def docs
Definition: noxfile.py:55
def build
Definition: noxfile.py:86
def tests_packaging
Definition: noxfile.py:45
def lint
Definition: noxfile.py:15
def make_changelog
Definition: noxfile.py:77
def tests
Definition: noxfile.py:24


gtsam
Author(s):
autogenerated on Tue Jul 4 2023 02:34:58