Skip to content

Commit

Permalink
Only build in RTD and only doctests in CI (#691)
Browse files Browse the repository at this point in the history
* Only build in RTD and only doctests in CI

* Adjust CI and contributing docs
  • Loading branch information
hynek authored Jan 16, 2025
1 parent e97b839 commit bc147a4
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 26 deletions.
10 changes: 8 additions & 2 deletions .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -93,14 +93,20 @@ $ tox run -e docs-watch

This will build the documentation, watch for changes, and rebuild it whenever you save a file.

To just build the documentation and run doctests, use:
To just build the documentation and exit immediately use:

```console
$ tox run -e docs
$ tox run -e docs-build
```

You will find the built documentation in `docs/_build/html`.

To run doctests:

```console
$ tox run -e docs-doctests
```


## Code

Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ jobs:
docs:
name: Build docs & run doctests
name: Run doctests
needs: build-package
runs-on: ubuntu-latest
steps:
Expand All @@ -189,7 +189,7 @@ jobs:

- run: >
uvx --with tox-uv
tox run -e docs
tox run -e docs-doctests
install-dev:
Expand Down
21 changes: 11 additions & 10 deletions .readthedocs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,16 @@ build:
tools:
# Keep version in sync with tox.ini/docs and ci.yml/docs.
python: "3.13"
commands:
# Need the tags to calculate the version (sometimes).
- git fetch --tags
- asdf plugin add uv
- asdf install uv latest
- asdf global uv latest
jobs:
create_environment:
# Need the tags to calculate the version (sometimes).
- git fetch --tags

- uvx --with tox-uv tox run -e docs-sponsors
- uvx --with tox-uv tox run -e docs -- $READTHEDOCS_OUTPUT
- asdf plugin add uv
- asdf install uv latest
- asdf global uv latest

sphinx:
configuration: docs/conf.py
build:
html:
- uvx --with tox-uv tox run -e docs-sponsors
- uvx --with tox-uv tox run -e docs-build -- $READTHEDOCS_OUTPUT
19 changes: 7 additions & 12 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ env_list =
mypy-pkg,
py3{8,9,10,11,12,13}-{tests,mypy}
py3{8,13}-tests-{colorama,be,rich},
docs{,-sponsors},
docs-{sponsors,doctests},
coverage-report


Expand Down Expand Up @@ -43,19 +43,19 @@ commands =
coverage report


[testenv:docs]
[testenv:docs-{build,doctests,linkcheck}]
# Keep base_python in sync with ci.yml/docs and .readthedocs.yaml.
base_python = py313
extras = docs
commands =
sphinx-build -n -T -W -b html -d {envtmpdir}/doctrees docs {posargs:docs/_build/}html
sphinx-build -n -T -W -b doctest -d {envtmpdir}/doctrees docs {posargs:docs/_build/}html

build: sphinx-build -n -T -W -b html -d {envtmpdir}/doctrees docs {posargs:docs/_build/}html
doctests: sphinx-build -n -T -W -b doctest -d {envtmpdir}/doctrees docs {posargs:docs/_build/}html
linkcheck: sphinx-build -W -b linkcheck -d {envtmpdir}/doctrees docs docs/_build/html

[testenv:docs-watch]
package = editable
base_python = {[testenv:docs]base_python}
extras = {[testenv:docs]extras}
base_python = {[testenv:docs-build]base_python}
extras = {[testenv:docs-build]extras}
deps = watchfiles
commands =
watchfiles \
Expand All @@ -64,11 +64,6 @@ commands =
src \
docs

[testenv:docs-linkcheck]
base_python = {[testenv:docs]base_python}
extras = {[testenv:docs]extras}
commands = sphinx-build -W -b linkcheck -d {envtmpdir}/doctrees docs docs/_build/html

[testenv:docs-sponsors]
description = Ensure sponsor logos are up to date.
deps = cogapp
Expand Down

0 comments on commit bc147a4

Please sign in to comment.