Skip to content

Commit

Permalink
Add live-docs to tox
Browse files Browse the repository at this point in the history
  • Loading branch information
trallard committed May 9, 2024
1 parent 0532405 commit 800b89c
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 5 deletions.
9 changes: 4 additions & 5 deletions docs/community/setup.md
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ The caveat to using `tox` is that this will not install the required hooks to ru

Now that you have `tox` installed and cloned the repository, you should be able to build the documentation locally.

To build the documentation with `nox`, run the following command:
To build the documentation with `tox`, run the following command:

```console
$ tox run -e docs-dev
Expand Down Expand Up @@ -147,23 +147,22 @@ Compiled assets are **not committed to git**.
The `sphinx-theme-builder` will bundle these assets automatically when we make a new release, but we do not manually commit these compiled assets to Git history.
```

<!-- TODO update or remove -->

## Run a development server

You can combine the above two actions (build the docs and compile JS/CSS assets) and run a development server so that changes to `src/` are automatically bundled with the package, and the documentation is immediately reloaded in a live preview window.

To run the development server with `nox`, run the following command:
To run the development server with `tox`, run the following command:

```console
$ nox -s docs-live
$ tox -e run docs-live
```

When working on the theme, making changes to any of these directories:

- `src/js/index.js`
- `src/scss/index.scss`
- `docs/**/*.rst`
- `docs/**/*.md`
- `docs/**/*.py`

will cause the development server to do the following:
Expand Down
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ doc = [
test = ["pytest", "pytest-cov", "pytest-regressions", 'sphinx[test]']
dev = ["pyyaml", "pre-commit", "nox", "pydata-sphinx-theme[doc,test]", "tox", "pandoc", "sphinx-theme-builder[cli]"]
a11y = ["pytest-playwright"]
i18n = ["Babel", "jinja2"]

[project.entry-points]
"sphinx.html_themes" = { pydata_sphinx_theme = "pydata_sphinx_theme" }
Expand Down
15 changes: 15 additions & 0 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -103,3 +103,18 @@ package = editable
commands =
sphinx-build -b html docs/ docs/_build/html -v -w warnings.txt {posargs}
python tests/utils/check_warnings.py


[testenv:docs-live]
description = "Build and serve the documentation with live-reload"
extras =
dev
i18n
package = editable
deps =
sphinx-theme-builder[cli]@git+https://github.com/pradyunsg/sphinx-theme-builder#egg=d9f620b
# suppress Py3.11's new "can't debug frozen modules" warning
set_env = PYDEVD_DISABLE_FILE_VALIDATION=1
commands =
pybabel compile -d src/pydata_sphinx_theme/locale -D sphinx
stb serve docs --open-browser --re-ignore=locale|api|_build|\.jupyterlite\.doit\.db

0 comments on commit 800b89c

Please sign in to comment.