Skip to content

Commit 8422edf

Browse files
authored
PYTHON-4054 Add ability to serve live docs (#1447)
1 parent 8c293d2 commit 8422edf

File tree

2 files changed

+24
-2
lines changed

2 files changed

+24
-2
lines changed

CONTRIBUTING.md

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -172,14 +172,25 @@ request](https://help.github.com/articles/using-pull-requests). You
172172
might also use the GitHub
173173
[Edit](https://github.com/blog/844-forking-with-the-edit-button) button.
174174

175-
We use the [Sphinx docstring format](https://sphinx-rtd-tutorial.readthedocs.io/en/latest/docstrings.html).
175+
We use [reStructuredText](https://www.sphinx-doc.org/en/master/usage/restructuredtext/basics.html) for all
176+
documentation including narrative docs, and the [Sphinx docstring format](https://sphinx-rtd-tutorial.readthedocs.io/en/latest/docstrings.html).
176177

177178
You can build the documentation locally by running:
178179

179180
```bash
180181
tox -e doc
181182
```
182183

184+
When updating docs, it can be helpful to run the live docs server as:
185+
186+
```bash
187+
tox -e doc-serve
188+
```
189+
190+
Browse to the link provided, and then as you make changes to docstrings or narrative docs,
191+
the pages will re-render and the browser will automatically refresh.
192+
193+
183194
## Running Tests Locally
184195

185196
- Ensure you have started the appropriate Mongo Server(s).

tox.ini

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ envlist =
2121
typecheck,
2222
# Build sphinx docs
2323
doc,
24+
# Server live sphinx docs
25+
doc-serve,
2426
# Test sphinx docs
2527
doc-test,
2628
# Linkcheck sphinx docs
@@ -38,6 +40,7 @@ labels = # Use labels and -m instead of -e so that tox -m <label> fails instantl
3840
typecheck-pyright-strict = typecheck-pyright-strict
3941
typecheck = typecheck
4042
doc = doc
43+
doc-serve = doc-serve
4144
doc-test = doc-test
4245
linkcheck = linkcheck
4346
test-mockupdb = test-mockupdb
@@ -134,7 +137,15 @@ description = build sphinx docs
134137
deps =
135138
-rdoc/docs-requirements.txt
136139
commands =
137-
sphinx-build -E -W -b html doc ./doc/_build/html
140+
sphinx-build -W -b html doc ./doc/_build/html
141+
142+
[testenv:doc-serve]
143+
description = serve sphinx docs
144+
deps =
145+
{[testenv:doc]deps}
146+
sphinx-autobuild
147+
commands =
148+
sphinx-autobuild -W -b html doc --watch ./pymongo --watch ./bson --watch ./gridfs ./doc/_build/serve
138149

139150
[testenv:doc-test]
140151
description = run sphinx doc tests

0 commit comments

Comments
 (0)