Skip to content

Commit

Permalink
Only build docs in RTD and only run doctests in CI
Browse files Browse the repository at this point in the history
  • Loading branch information
hynek committed Jan 16, 2025
1 parent 3b6a276 commit f6bbe0d
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 15 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ jobs:
if: ${{ failure() }}

docs:
name: Build docs & run doctests
name: Run doctests
runs-on: ubuntu-latest
needs: build-package
steps:
Expand All @@ -188,7 +188,7 @@ jobs:
python-version: "3.13"
- uses: hynek/setup-cached-uv@v2

- run: uvx --with=tox-uv tox run -e docs,changelog
- run: uvx --with=tox-uv tox run -e docs-doctests,changelog

pyright:
name: Check types using pyright
Expand Down
20 changes: 12 additions & 8 deletions .readthedocs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +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

build:
html:
- uvx --with tox-uv tox run -e docs-sponsors
- uvx --with tox-uv tox run -e docs-build -- $READTHEDOCS_OUTPUT
9 changes: 4 additions & 5 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ env_list =
py3{10,11,12,13}-mypy,
pypy3-tests,
pyright,
docs{,-sponsors},
docs-{sponsors,doctests},
changelog,
coverage-report

Expand Down Expand Up @@ -40,7 +40,6 @@ set_env =
PYTHONWARNINGS=d
commands_pre = python -c 'import pathlib; pathlib.Path("{env_site_packages_dir}/cov.pth").write_text("import coverage; coverage.process_startup()")'
commands =
uv pip list -p {envpython}
coverage run -m pytest {posargs}

[testenv:coverage-report]
Expand All @@ -66,14 +65,14 @@ pass_env =
commands = pytest --codspeed -n auto bench/test_benchmarks.py


[testenv:docs]
[testenv:docs-{build,doctests}]
runner = uv-venv-lock-runner
# Keep base_python in-sync with ci.yml/docs and .readthedocs.yaml.
base_python = py313
dependency_groups = 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
doctests: 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


[testenv:docs-watch]
Expand Down

0 comments on commit f6bbe0d

Please sign in to comment.