chore(dev): add option for serving docs locally · python-gitlab/python-gitlab@beb2f24

3 files changed

lines changed

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
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

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 =