From aebd21b53c6be5a817a50491327371393aa9d8de Mon Sep 17 00:00:00 2001 From: Henry Schreiner Date: Wed, 10 Nov 2021 12:13:10 -0500 Subject: [PATCH] docs: rework CI a bit, more modern skipping (#3424) * docs: rework CI a bit, more modern skipping * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> --- .github/workflows/ci.yml | 9 +++------ docs/Doxyfile | 3 +-- docs/requirements.txt | 13 +++++-------- include/pybind11/pytypes.h | 8 ++++---- noxfile.py | 10 ++++++---- 5 files changed, 19 insertions(+), 24 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 3694f163..2888c420 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -704,14 +704,11 @@ jobs: - name: Install Doxygen run: sudo apt-get install -y doxygen librsvg2-bin # Changed to rsvg-convert in 20.04 - - name: Install docs & setup requirements - run: python3 -m pip install -r docs/requirements.txt - - name: Build docs - run: python3 -m sphinx -W -b html docs docs/.build + run: pipx run nox -s docs - name: Make SDist - run: python3 setup.py sdist + run: pipx run nox -s build -- --sdist - run: git status --ignored @@ -723,7 +720,7 @@ jobs: - name: Compare Dists (headers only) working-directory: include run: | - python3 -m pip install --user -U ../dist/* + python3 -m pip install --user -U ../dist/*.tar.gz installed=$(python3 -c "import pybind11; print(pybind11.get_include() + '/pybind11')") diff -rq $installed ./pybind11 diff --git a/docs/Doxyfile b/docs/Doxyfile index c8562952..62c26755 100644 --- a/docs/Doxyfile +++ b/docs/Doxyfile @@ -18,6 +18,5 @@ ALIASES += "endrst=\endverbatim" QUIET = YES WARNINGS = YES WARN_IF_UNDOCUMENTED = NO -PREDEFINED = DOXYGEN_SHOULD_SKIP_THIS \ - PY_MAJOR_VERSION=3 \ +PREDEFINED = PY_MAJOR_VERSION=3 \ PYBIND11_NOINLINE diff --git a/docs/requirements.txt b/docs/requirements.txt index 8f293b5d..b2801b1f 100644 --- a/docs/requirements.txt +++ b/docs/requirements.txt @@ -1,8 +1,5 @@ -breathe==4.26.1 -# docutils 0.17 breaks HTML tags & RTD theme -# https://github.com/sphinx-doc/sphinx/issues/9001 -docutils==0.16 -sphinx==3.3.1 -sphinx_rtd_theme==0.5.0 -sphinxcontrib-moderncmakedomain==3.17 -sphinxcontrib-svg2pdfconverter==1.1.0 +breathe==4.31.0 +sphinx==3.5.4 +sphinx_rtd_theme==1.0.0 +sphinxcontrib-moderncmakedomain==3.19 +sphinxcontrib-svg2pdfconverter==1.1.1 diff --git a/include/pybind11/pytypes.h b/include/pybind11/pytypes.h index f54d5fad..a08fd8ce 100644 --- a/include/pybind11/pytypes.h +++ b/include/pybind11/pytypes.h @@ -287,10 +287,10 @@ protected: struct borrowed_t { }; struct stolen_t { }; -#ifndef DOXYGEN_SHOULD_SKIP_THIS // Issue in breathe 4.26.1 + /// @cond BROKEN template friend T reinterpret_borrow(handle); template friend T reinterpret_steal(handle); -#endif + /// @endcond public: // Only accessible from derived classes and the reinterpret_* functions @@ -1717,7 +1717,7 @@ public: #endif }; -#ifndef DOXYGEN_SHOULD_SKIP_THIS +/// @cond DUPLICATE inline memoryview memoryview::from_buffer( void *ptr, ssize_t itemsize, const char* format, detail::any_container shape, @@ -1745,7 +1745,7 @@ inline memoryview memoryview::from_buffer( throw error_already_set(); return memoryview(object(obj, stolen_t{})); } -#endif // DOXYGEN_SHOULD_SKIP_THIS +/// @endcond /// @} pytypes /// \addtogroup python_builtins diff --git a/noxfile.py b/noxfile.py index 53d87dbc..4adffac2 100644 --- a/noxfile.py +++ b/noxfile.py @@ -57,10 +57,10 @@ def docs(session: nox.Session) -> None: session.chdir("docs") if "pdf" in session.posargs: - session.run("sphinx-build", "-M", "latexpdf", ".", "_build") + session.run("sphinx-build", "-b", "latexpdf", ".", "_build") return - session.run("sphinx-build", "-M", "html", ".", "_build") + 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") @@ -86,6 +86,8 @@ def build(session: nox.Session) -> None: session.install("build") session.log("Building normal files") - session.run("python", "-m", "build") + session.run("python", "-m", "build", *session.posargs) session.log("Building pybind11-global files (PYBIND11_GLOBAL_SDIST=1)") - session.run("python", "-m", "build", env={"PYBIND11_GLOBAL_SDIST": "1"}) + session.run( + "python", "-m", "build", *session.posargs, env={"PYBIND11_GLOBAL_SDIST": "1"} + )