Skip to content

Commit beb2f24

Browse files
amimasnejch
authored andcommitted
chore(dev): add option for serving docs locally
This update can be helpful when changing documentation by serving the docs locally to ensure content presentation and format is as-expected.
1 parent f36614f commit beb2f24

File tree

3 files changed

+18
-2
lines changed

3 files changed

+18
-2
lines changed

CONTRIBUTING.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,9 @@ You need to install ``tox`` (``pip3 install tox``) to run tests and lint checks
8181
# build the documentation - the result will be generated in build/sphinx/html/:
8282
tox -e docs
8383
84+
# build and serve the documentation site locally for validating changes
85+
tox -e docs-serve
86+
8487
# List all available tox environments
8588
tox list
8689

requirements-docs.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,4 @@ jinja2==3.1.5
44
myst-parser==4.0.0
55
sphinx==8.1.3
66
sphinxcontrib-autoprogram==0.1.9
7+
sphinx-autobuild==2024.10.3

tox.ini

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,10 @@ passenv =
2626
NO_COLOR
2727
PWD
2828
PY_COLORS
29-
setenv = VIRTUAL_ENV={envdir}
29+
setenv =
30+
DOCS_SOURCE = docs
31+
DOCS_BUILD = build/sphinx/html
32+
VIRTUAL_ENV={envdir}
3033
whitelist_externals = true
3134
usedevelop = True
3235
install_command = pip install {opts} {packages} -e .
@@ -99,8 +102,17 @@ per-file-ignores =
99102
gitlab/v4/objects/__init__.py:F401,F403
100103

101104
[testenv:docs]
105+
description = Builds the docs site. Generated HTML files will be available in '{env:DOCS_BUILD}'.
102106
deps = -r{toxinidir}/requirements-docs.txt
103-
commands = sphinx-build -n -W --keep-going -b html docs build/sphinx/html
107+
commands = sphinx-build -n -W --keep-going -b html {env:DOCS_SOURCE} {env:DOCS_BUILD}
108+
109+
[testenv:docs-serve]
110+
description =
111+
Builds and serves the HTML docs site locally. \
112+
Use this for verifying updates to docs. \
113+
Changes to docs files will be automatically rebuilt and served.
114+
deps = -r{toxinidir}/requirements-docs.txt
115+
commands = sphinx-autobuild {env:DOCS_SOURCE} {env:DOCS_BUILD} --open-browser --port 8000
104116

105117
[testenv:cover]
106118
commands =

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy