Skip to content
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions doc/changelog.d/642.added.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
feat: Add Tox environment for documentation preview
3 changes: 2 additions & 1 deletion doc/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
)

THIS_PATH = Path(__file__).parent.resolve()
PYANSYS_LIGHT_SQUARE = (THIS_PATH / "_static" / "pyansys_light_square.png").resolve()
EXAMPLE_PATH = (THIS_PATH / "examples" / "sphinx_examples").resolve()

# Project information
Expand Down Expand Up @@ -270,7 +271,7 @@ def download_and_process_files(example_links: List[str]) -> List[str]:
"download_all_examples": False,
# Modules for which function level galleries are created. In
"image_scrapers": ("pyvista", "matplotlib"),
"default_thumb_file": "source/_static/pyansys_light_square.png",
"default_thumb_file": str(PYANSYS_LIGHT_SQUARE),
}

nbsphinx_prolog = """
Expand Down
6 changes: 6 additions & 0 deletions doc/source/contribute/developer.rst
Original file line number Diff line number Diff line change
Expand Up @@ -239,3 +239,9 @@ You can clean the build directory by running::

# On Windows
doc\make.bat clean

.. Note::

Use ``tox -e doc-serve`` to build the documentation and open it in your
default browser. This command will also watch for changes in the source
files and rebuild the documentation automatically.
13 changes: 9 additions & 4 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ envlist =
code-style
doc-style
doc-{links,html,pdf,clean}
doc-preview
dist
skip_missing_interpreters = true
isolated_build = true
Expand Down Expand Up @@ -36,10 +37,13 @@ commands =
vale sync --config="{toxinidir}/doc/.vale.ini"
vale --config="{toxinidir}/doc/.vale.ini" "{toxinidir}/doc"

[testenv:doc-{clean,links,html,pdf}]
[testenv:doc-{clean,links,html,pdf,serve}]
description = Checks documentation links and pages generates properly
deps=
serve: sphinx-theme-builder[cli] @ https://github.com/pradyunsg/sphinx-theme-builder/archive/d9f620b1a73839728c95b596343595d3952ec8bf.zip
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not required. The build system is already installing the STB tool.

allowlist_externals =
pdflatex
pdf: pdflatex
serve: stb
extras = doc
setenv =
SOURCE_DIR = doc/source
Expand All @@ -50,12 +54,13 @@ setenv =
links,html,pdf: BUILDER_OPTS = --color -v -j auto -W --keep-going
commands =
links,html,pdf: sphinx-build -d "{toxworkdir}/doc_doctree" {env:SOURCE_DIR} "{toxinidir}/{env:BUILD_DIR}/{env:BUILDER}" {env:BUILDER_OPTS} -b {env:BUILDER}
clean: python -c "import shutil, sys; shutil.rmtree(sys.argv[1], ignore_errors=True)" "{toxinidir}/{env:BUILD_DIR}"
clean: python -c "import shutil, sys; shutil.rmtree(sys.argv[1], ignore_errors=True)" "{toxinidir}/{env:BUILD_DIR}"
serve: stb serve "{toxinidir}/{env:SOURCE_DIR}" --open-browser

[testenv:dist]
description = Checks project distribution
skip_install = true
deps =
build
commands =
python -m build {toxinidir}
python -m build {toxinidir}
Loading