mirror of
https://github.com/RYDE-WORK/pybind11.git
synced 2026-01-19 21:23:26 +08:00
* `#error BYE_BYE_GOLDEN_SNAKE` * Removing everything related to 2.7 from ci.yml * Commenting-out Centos7 * Removing `PYTHON: 27` from .appveyor.yml * "PY2" removal, mainly from tests. C++ code is not touched. * Systematic removal of `u` prefix from `u"..."` and `u'...'` literals. Collateral cleanup of a couple minor other things. * Cleaning up around case-insensitive hits for `[^a-z]py.*2` in tests/. * Removing obsolete Python 2 mention in compiling.rst * Proper `#error` for Python 2. * Using PY_VERSION_HEX to guard `#error "PYTHON 2 IS NO LONGER SUPPORTED.` * chore: bump pre-commit * style: run pre-commit for pyupgrade 3+ * tests: use sys.version_info, not PY * chore: more Python 2 removal * Uncommenting Centos7 block (PR #3691 showed that it is working again). * Update pre-commit hooks * Fix pre-commit hook * refactor: remove Python 2 from CMake * refactor: remove Python 2 from setup code * refactor: simplify, better static typing * feat: fail with nice messages * refactor: drop Python 2 C++ code * docs: cleanup for Python 3 * revert: intree revert: intree * docs: minor touchup to py2 statement Co-authored-by: Henry Schreiner <henryschreineriii@gmail.com> Co-authored-by: Aaron Gokaslan <skylion.aaron@gmail.com>
94 lines
2.5 KiB
Python
94 lines
2.5 KiB
Python
import nox
|
|
|
|
nox.options.sessions = ["lint", "tests", "tests_packaging"]
|
|
|
|
PYTHON_VERISONS = ["3.5", "3.6", "3.7", "3.8", "3.9", "3.10", "3.11"]
|
|
|
|
|
|
@nox.session(reuse_venv=True)
|
|
def lint(session: nox.Session) -> None:
|
|
"""
|
|
Lint the codebase (except for clang-format/tidy).
|
|
"""
|
|
session.install("pre-commit")
|
|
session.run("pre-commit", "run", "-a")
|
|
|
|
|
|
@nox.session(python=PYTHON_VERISONS)
|
|
def tests(session: nox.Session) -> None:
|
|
"""
|
|
Run the tests (requires a compiler).
|
|
"""
|
|
tmpdir = session.create_tmp()
|
|
session.install("cmake")
|
|
session.install("-r", "tests/requirements.txt")
|
|
session.run(
|
|
"cmake",
|
|
"-S",
|
|
".",
|
|
"-B",
|
|
tmpdir,
|
|
"-DPYBIND11_WERROR=ON",
|
|
"-DDOWNLOAD_CATCH=ON",
|
|
"-DDOWNLOAD_EIGEN=ON",
|
|
*session.posargs
|
|
)
|
|
session.run("cmake", "--build", tmpdir)
|
|
session.run("cmake", "--build", tmpdir, "--config=Release", "--target", "check")
|
|
|
|
|
|
@nox.session
|
|
def tests_packaging(session: nox.Session) -> None:
|
|
"""
|
|
Run the packaging tests.
|
|
"""
|
|
|
|
session.install("-r", "tests/requirements.txt", "--prefer-binary")
|
|
session.run("pytest", "tests/extra_python_package")
|
|
|
|
|
|
@nox.session(reuse_venv=True)
|
|
def docs(session: nox.Session) -> None:
|
|
"""
|
|
Build the docs. Pass "serve" to serve.
|
|
"""
|
|
|
|
session.install("-r", "docs/requirements.txt")
|
|
session.chdir("docs")
|
|
|
|
if "pdf" in session.posargs:
|
|
session.run("sphinx-build", "-b", "latexpdf", ".", "_build")
|
|
return
|
|
|
|
session.run("sphinx-build", "-b", "html", ".", "_build")
|
|
|
|
if "serve" in session.posargs:
|
|
session.log("Launching docs at http://localhost:8000/ - use Ctrl-C to quit")
|
|
session.run("python", "-m", "http.server", "8000", "-d", "_build/html")
|
|
elif session.posargs:
|
|
session.error("Unsupported argument to docs")
|
|
|
|
|
|
@nox.session(reuse_venv=True)
|
|
def make_changelog(session: nox.Session) -> None:
|
|
"""
|
|
Inspect the closed issues and make entries for a changelog.
|
|
"""
|
|
session.install("ghapi", "rich")
|
|
session.run("python", "tools/make_changelog.py")
|
|
|
|
|
|
@nox.session(reuse_venv=True)
|
|
def build(session: nox.Session) -> None:
|
|
"""
|
|
Build SDists and wheels.
|
|
"""
|
|
|
|
session.install("build")
|
|
session.log("Building normal files")
|
|
session.run("python", "-m", "build", *session.posargs)
|
|
session.log("Building pybind11-global files (PYBIND11_GLOBAL_SDIST=1)")
|
|
session.run(
|
|
"python", "-m", "build", *session.posargs, env={"PYBIND11_GLOBAL_SDIST": "1"}
|
|
)
|