Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update ReadTheDocs settings file #2083

Merged
merged 14 commits into from
Jan 24, 2025
34 changes: 34 additions & 0 deletions .readthedocs.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
version: 2

formats:
- htmlzip

# build with latest available ubuntu version
build:
os: ubuntu-lts-latest
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this just seems like common sense

tools:
python: "3.12"
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ditto, no reason to build on an old Py version

# need to install playwright deps via apt (lack of sudo means we can't use
# `playwright install-deps`). NB: Graphviz is a separate dep urelated to playwright
apt_packages:
- graphviz
- libasound2
- libdbus-glib-1-2
jobs:
# build the gallery of themes before building the doc
post_install:
- pip install playwright
- playwright install chromium
drammock marked this conversation as resolved.
Show resolved Hide resolved
- python ./docs/scripts/generate_gallery_images.py

sphinx:
configuration: docs/conf.py
Comment on lines +24 to +25
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this bit is now required, and our builds will start failing in January without it.

# builder: "dirhtml"
fail_on_warning: false # we have some unavoidable warnings, and a separate warnings checker

python:
install:
- method: pip
path: .
extra_requirements:
- doc
Comment on lines +32 to +34
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is the recommended way to do what we were doing before with path: .[doc]

21 changes: 21 additions & 0 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -291,6 +291,27 @@
autoapi_root = "api"
autoapi_member_order = "groupwise"

# -- Warnings / Nitpicky -------------------------------------------------------

nitpicky = True
bad_classes = (
r".*abc def.*", # urllib.parse.unquote_to_bytes
r"api_sample\.RandomNumberGenerator",
r"bs4\.BeautifulSoup",
r"docutils\.nodes\.Node",
r"matplotlib\.artist\.Artist", # matplotlib xrefs are in the class diagram demo
r"matplotlib\.figure\.Figure",
r"matplotlib\.figure\.FigureBase",
r"pygments\.formatters\.HtmlFormatter",
)
nitpick_ignore_regex = [
*[("py:class", target) for target in bad_classes],
# we demo some `urllib` docs on our site; don't care that its xrefs fail to resolve
("py:obj", r"urllib\.parse\.(Defrag|Parse|Split)Result(Bytes)?\.(count|index)"),
# the kitchen sink pages include some intentional errors
("token", r"(suite|expression|target)"),
]
Comment on lines +296 to +313
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This captures all of the unavoidable "reference target not found" warnings that sphinx generates when nitpicky is turned on. Now, if a new bad cross-ref gets introduced, it will show up as a warning, and cause our post-build warnings checker function to fail.

(even with this, there are still ~15 warnings that are always generated, but they're not sphinx xref errors, so can't be dealt with by the nitpicky system. cf. tests/warning_list.txt)


# -- application setup -------------------------------------------------------


Expand Down
22 changes: 0 additions & 22 deletions readthedocs.yml

This file was deleted.

4 changes: 2 additions & 2 deletions tests/utils/check_warnings.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ def check_warnings(file: Path) -> bool:
print("\n=== Sphinx Warnings test ===\n")

# find the file where all the known warnings are stored
warning_file = Path(__file__).parent.parent / "warning_list.txt"
extra_warning_file = Path(__file__).parent.parent / "intermittent_warning_list.txt"
warning_file = Path(__file__).parents[1] / "warning_list.txt"
extra_warning_file = Path(__file__).parents[1] / "intermittent_warning_list.txt"
Comment on lines +33 to +34
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

unrelated simplification, noticed in passing


received_warnings = escape_ansi(file.read_text()).strip().split("\n")
expected_warnings = warning_file.read_text().strip().split("\n")
Expand Down
4 changes: 2 additions & 2 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ extras = {[testenv:docs-no-checks]extras}
deps =
py39-sphinx61-docs: sphinx~=6.1.0
commands =
sphinx-build -b html docs/ docs/_build/html -v -w warnings.txt {posargs}
sphinx-build -b html docs/ docs/_build/html -nTv -w warnings.txt {posargs}
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

-n forces nitpicky mode. Not strictly necessary, since we set nitpicky=True in conf.py now

-T show full traceback on error.

python tests/utils/check_warnings.py

# recommended for local development, this command will build the PST documentation
Expand All @@ -122,7 +122,7 @@ set_env = PYDEVD_DISABLE_FILE_VALIDATION=1
extras = {[testenv:docs-no-checks]extras}
package = editable
commands =
sphinx-build -b html docs/ docs/_build/html -v -w warnings.txt {posargs}
sphinx-build -b html docs/ docs/_build/html -nTv -w warnings.txt {posargs}
python tests/utils/check_warnings.py

# build the docs with live-reload, if you are working on the docs only (no theme changes) the best option is to call
Expand Down
Loading