Skip to content

Commit 0a45c09

Browse files
committed
add recipe to fetch intersphinx references for a package
1 parent da8f6a5 commit 0a45c09

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

justfile

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,28 @@ check-docs-links: _link_check
153153
check-docs:
154154
@just run doc8 --ignore-path ./doc/build --max-line-length 100 -q ./doc
155155

156+
# fetch the intersphinx references for the given package
157+
[script]
158+
fetch-refs LIB: install-docs
159+
import os
160+
from pathlib import Path
161+
import logging as _logging
162+
import sys
163+
import runpy
164+
from sphinx.ext.intersphinx import inspect_main
165+
_logging.basicConfig()
166+
167+
libs = runpy.run_path(Path(os.getcwd()) / "doc/source/conf.py").get("intersphinx_mapping")
168+
url = libs.get("{{ LIB }}", None)
169+
if not url:
170+
sys.exit(f"Unrecognized {{ LIB }}, must be one of: {', '.join(libs.keys())}")
171+
if url[1] is None:
172+
url = f"{url[0].rstrip('/')}/objects.inv"
173+
else:
174+
url = url[1]
175+
176+
raise SystemExit(inspect_main([url]))
177+
156178
# lint the code
157179
check-lint:
158180
@just run ruff check --select I

0 commit comments

Comments
 (0)