diff --git a/ci/build_docs.sh b/ci/build_docs.sh index 5a4bf3e0dbc..2b55a9db8af 100755 --- a/ci/build_docs.sh +++ b/ci/build_docs.sh @@ -41,19 +41,25 @@ popd rapids-logger "Build Python docs" pushd docs/cudf make dirhtml -make text -mkdir -p "${RAPIDS_DOCS_DIR}/cudf/"{html,txt} +mkdir -p "${RAPIDS_DOCS_DIR}/cudf/html" mv build/dirhtml/* "${RAPIDS_DOCS_DIR}/cudf/html" -mv build/text/* "${RAPIDS_DOCS_DIR}/cudf/txt" +if [[ "${RAPIDS_BUILD_TYPE}" != "pull-request" ]]; then + make text + mkdir -p "${RAPIDS_DOCS_DIR}/cudf/txt" + mv build/text/* "${RAPIDS_DOCS_DIR}/cudf/txt" +fi popd rapids-logger "Build dask-cuDF Sphinx docs" pushd docs/dask_cudf make dirhtml -make text -mkdir -p "${RAPIDS_DOCS_DIR}/dask-cudf/"{html,txt} +mkdir -p "${RAPIDS_DOCS_DIR}/dask-cudf/html" mv build/dirhtml/* "${RAPIDS_DOCS_DIR}/dask-cudf/html" -mv build/text/* "${RAPIDS_DOCS_DIR}/dask-cudf/txt" +if [[ "${RAPIDS_BUILD_TYPE}" != "pull-request" ]]; then + make text + mkdir -p "${RAPIDS_DOCS_DIR}/dask-cudf/txt" + mv build/text/* "${RAPIDS_DOCS_DIR}/dask-cudf/txt" +fi popd rapids-upload-docs diff --git a/conda/environments/all_cuda-118_arch-x86_64.yaml b/conda/environments/all_cuda-118_arch-x86_64.yaml index 8081d9de8b9..2794125b78a 100644 --- a/conda/environments/all_cuda-118_arch-x86_64.yaml +++ b/conda/environments/all_cuda-118_arch-x86_64.yaml @@ -93,6 +93,7 @@ dependencies: - sphinx-autobuild - sphinx-copybutton - sphinx-markdown-tables +- sphinx-remove-toctrees - sphinxcontrib-websupport - streamz - sysroot_linux-64==2.17 diff --git a/conda/environments/all_cuda-120_arch-x86_64.yaml b/conda/environments/all_cuda-120_arch-x86_64.yaml index 1cb8f376f82..91104c55961 100644 --- a/conda/environments/all_cuda-120_arch-x86_64.yaml +++ b/conda/environments/all_cuda-120_arch-x86_64.yaml @@ -91,6 +91,7 @@ dependencies: - sphinx-autobuild - sphinx-copybutton - sphinx-markdown-tables +- sphinx-remove-toctrees - sphinxcontrib-websupport - streamz - sysroot_linux-64==2.17 diff --git a/dependencies.yaml b/dependencies.yaml index e62fa86d4d4..09866869a8b 100644 --- a/dependencies.yaml +++ b/dependencies.yaml @@ -472,6 +472,7 @@ dependencies: - sphinx-autobuild - sphinx-copybutton - sphinx-markdown-tables + - sphinx-remove-toctrees - sphinxcontrib-websupport notebooks: common: diff --git a/docs/cudf/source/conf.py b/docs/cudf/source/conf.py index 01a6c5316bd..5b04335f475 100644 --- a/docs/cudf/source/conf.py +++ b/docs/cudf/source/conf.py @@ -16,10 +16,12 @@ # add these directories to sys.path here. If the directory is relative to the # documentation root, use os.path.abspath to make it absolute, like shown here. # +import filecmp import glob import os import re import sys +import tempfile import xml.etree.ElementTree as ET from docutils.nodes import Text @@ -62,6 +64,7 @@ class PseudoLexer(RegexLexer): "sphinx.ext.autodoc", "sphinx.ext.autosummary", "sphinx_copybutton", + "sphinx_remove_toctrees", "numpydoc", "IPython.sphinxext.ipython_console_highlighting", "IPython.sphinxext.ipython_directive", @@ -69,6 +72,8 @@ class PseudoLexer(RegexLexer): "myst_nb", ] +remove_from_toctrees = ["user_guide/api_docs/api/*"] + # Preprocess doxygen xml for compatibility with latest Breathe def clean_definitions(root): @@ -126,7 +131,13 @@ def clean_all_xml_files(path): for fn in glob.glob(os.path.join(path, "*.xml")): tree = ET.parse(fn) clean_definitions(tree.getroot()) - tree.write(fn) + with tempfile.NamedTemporaryFile() as tmp_fn: + tree.write(tmp_fn.name) + # Only write files that have actually changed. + if not filecmp.cmp(tmp_fn.name, fn): + tree.write(fn) + + # Breathe Configuration