Skip to content

Commit 29e09a8

Browse files
nchammassrowen
authored andcommitted
[SPARK-30084][DOCS] Document how to trigger Jekyll build on Python API doc changes
### What changes were proposed in this pull request? This PR adds a note to the docs README showing how to get Jekyll to automatically pick up changes to the Python API docs. ### Why are the changes needed? `jekyll serve --watch` doesn't watch for changes to the API docs. Without the technique documented in this note, or something equivalent, developers have to manually retrigger a Jekyll build any time they update the Python API docs. ### Does this PR introduce any user-facing change? No. ### How was this patch tested? I tested this PR manually by making changes to Python docstrings and confirming that Jekyll automatically picks them up and serves them locally. Closes apache#26719 from nchammas/SPARK-30084-watch-api-docs. Authored-by: Nicholas Chammas <[email protected]> Signed-off-by: Sean Owen <[email protected]>
1 parent 2ceed6f commit 29e09a8

File tree

2 files changed

+16
-1
lines changed

2 files changed

+16
-1
lines changed

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ dev/create-release/*final
4545
dev/create-release/*txt
4646
dev/pr-deps/
4747
dist/
48-
docs/_site
48+
docs/_site/
4949
docs/api
5050
sql/docs
5151
sql/site
@@ -63,6 +63,7 @@ project/plugins/target/
6363
python/lib/pyspark.zip
6464
python/.eggs/
6565
python/deps
66+
python/docs/_site/
6667
python/test_coverage/coverage_data
6768
python/test_coverage/htmlcov
6869
python/pyspark/python

docs/README.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,3 +102,17 @@ using [MkDocs](https://www.mkdocs.org/).
102102
NOTE: To skip the step of building and copying over the Scala, Java, Python, R and SQL API docs, run `SKIP_API=1
103103
jekyll build`. In addition, `SKIP_SCALADOC=1`, `SKIP_PYTHONDOC=1`, `SKIP_RDOC=1` and `SKIP_SQLDOC=1` can be used
104104
to skip a single step of the corresponding language. `SKIP_SCALADOC` indicates skipping both the Scala and Java docs.
105+
106+
### Automatically Rebuilding API Docs
107+
108+
`jekyll serve --watch` will only watch what's in `docs/`, and it won't follow symlinks. That means it won't monitor your API docs under `python/docs` or elsewhere.
109+
110+
To work around this limitation for Python, install [`entr`](http://eradman.com/entrproject/) and run the following in a separate shell:
111+
112+
```sh
113+
cd "$SPARK_HOME/python/docs"
114+
find .. -type f -name '*.py' \
115+
| entr -s 'make html && cp -r _build/html/. ../../docs/api/python'
116+
```
117+
118+
Whenever there is a change to your Python code, `entr` will automatically rebuild the Python API docs and copy them to `docs/`, thus triggering a Jekyll update.

0 commit comments

Comments
 (0)