Skip to content

Commit ac8e287

Browse files
Revathyvenugopal162pyansys-ci-botjorgepiloto
authored
feat: Add Tox environment for documentation preview (#642)
Co-authored-by: pyansys-ci-bot <[email protected]> Co-authored-by: Jorge Martinez <[email protected]>
1 parent c9ffb83 commit ac8e287

File tree

6 files changed

+21
-10
lines changed

6 files changed

+21
-10
lines changed

doc/changelog.d/642.added.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
feat: Add Tox environment for documentation preview

doc/source/conf.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
)
2727

2828
THIS_PATH = Path(__file__).parent.resolve()
29+
PYANSYS_LIGHT_SQUARE = (THIS_PATH / "_static" / "pyansys_light_square.png").resolve()
2930
EXAMPLE_PATH = (THIS_PATH / "examples" / "sphinx_examples").resolve()
3031

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

276277
nbsphinx_prolog = """

doc/source/contribute/developer.rst

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -239,3 +239,9 @@ You can clean the build directory by running::
239239

240240
# On Windows
241241
doc\make.bat clean
242+
243+
.. Note::
244+
245+
Use ``tox -e doc-serve`` to build the documentation and open it in your
246+
default browser. This command will also watch for changes in the source
247+
files and rebuild the documentation automatically.

package.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
11
{
22
"name": "ansys_sphinx_theme",
33
"repository": "https://github.com/ansys/ansys-sphinx-theme",
4-
54
"description": "",
65
"main": "",
76
"scripts": {
87
"build": "echo 'No build step needed' "
98
},
109
"dependencies": {},
1110
"devDependencies": {}
12-
}
11+
}

pyproject.toml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[build-system]
22
requires = [
3-
"sphinx-theme-builder >= 0.2.0b2,<1",
3+
"sphinx-theme-builder>=0.2.0b2,<1",
44
]
55
build-backend = "sphinx_theme_builder"
66

@@ -62,6 +62,7 @@ doc = [
6262
"sphinx-jinja==2.0.2",
6363
"sphinx-notfound-page==1.1.0",
6464
"tox==4.24.1",
65+
"sphinx-theme-builder[cli]==0.2.0b2",
6566
]
6667
changelog = [
6768
"PyYAML==6.0.2",
@@ -163,4 +164,4 @@ showcontent = true
163164
[[tool.towncrier.type]]
164165
directory = "miscellaneous"
165166
name = "Miscellaneous"
166-
showcontent = true
167+
showcontent = true

tox.ini

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ description = Default tox environments list
33
envlist =
44
code-style
55
doc-style
6-
doc-{links,html,pdf,clean}
6+
doc-{links,html,pdf,clean,serve}
77
dist
88
skip_missing_interpreters = true
99
isolated_build = true
@@ -36,10 +36,12 @@ commands =
3636
vale sync --config="{toxinidir}/doc/.vale.ini"
3737
vale --config="{toxinidir}/doc/.vale.ini" "{toxinidir}/doc"
3838

39-
[testenv:doc-{clean,links,html,pdf}]
39+
[testenv:doc-{clean,links,html,pdf,serve}]
4040
description = Checks documentation links and pages generates properly
41+
skip_install =
42+
clean: true
4143
allowlist_externals =
42-
pdflatex
44+
pdf: pdflatex
4345
extras = doc
4446
setenv =
4547
SOURCE_DIR = doc/source
@@ -50,12 +52,13 @@ setenv =
5052
links,html,pdf: BUILDER_OPTS = --color -v -j auto -W --keep-going
5153
commands =
5254
links,html,pdf: sphinx-build -d "{toxworkdir}/doc_doctree" {env:SOURCE_DIR} "{toxinidir}/{env:BUILD_DIR}/{env:BUILDER}" {env:BUILDER_OPTS} -b {env:BUILDER}
53-
clean: python -c "import shutil, sys; shutil.rmtree(sys.argv[1], ignore_errors=True)" "{toxinidir}/{env:BUILD_DIR}"
55+
clean: python -c "import shutil, sys; shutil.rmtree(sys.argv[1], ignore_errors=True)" "{toxinidir}/{env:BUILD_DIR}"
56+
serve: stb serve "{toxinidir}/{env:SOURCE_DIR}/"
5457

5558
[testenv:dist]
5659
description = Checks project distribution
5760
skip_install = true
5861
deps =
5962
build
6063
commands =
61-
python -m build {toxinidir}
64+
python -m build {toxinidir}

0 commit comments

Comments
 (0)