Compare commits

...
2 Commits
Author SHA1 Message Date
Laurens Valk 5d6ee68638 v4.0.0b11 2026-06-01 16:26:28 +02:00
Laurens Valk acf3b1be65 conf: Build a json symbol index on build.
Ship it with the docs so we can parse it in Pybricks for namespace based lookup.
2026-06-01 16:26:28 +02:00
2 changed files with 27 additions and 1 deletions
+26
View File
@@ -364,9 +364,35 @@ def on_missing_reference(
return nodes.Text(f"{ret_type}: {ret_unit}")
def on_build_finished(app: Sphinx, exception):
if exception or app.builder.name != "html":
return
import json
from sphinx.ext.intersphinx import InventoryFile
inv_path = os.path.join(app.outdir, "objects.inv")
if not os.path.exists(inv_path):
return
with open(inv_path, "rb") as f:
inv = InventoryFile.load(f, "", lambda base, uri: base + uri)
index = {}
for type_key, entries in inv.items():
if not type_key.startswith("py:"):
continue
for name, (project, version, url, display) in entries.items():
index[name] = url
out_path = os.path.join(app.outdir, "index.json")
with open(out_path, "w") as f:
json.dump(index, f, indent=2, sort_keys=True)
def setup(app: Sphinx):
app.add_directive("availability", AvailabilityDirective)
app.connect("missing-reference", on_missing_reference)
app.connect("build-finished", on_build_finished)
# -- Python domain hacks ---------------------------------------------------
+1 -1
View File
@@ -1,6 +1,6 @@
[tool.poetry]
name = "pybricks"
version = "4.0.0b10"
version = "4.0.0b11"
description = "Documentation and user-API stubs for Pybricks MicroPython"
authors = ["The Pybricks Authors <team@pybricks.com>"]
maintainers = ["Laurens Valk <laurens@pybricks.com>", "David Lechner <david@pybricks.com>" ]