mirror of
https://github.com/pybricks/pybricks-api.git
synced 2026-09-11 09:05:07 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
5d6ee68638 | ||
|
|
acf3b1be65 |
@@ -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
@@ -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>" ]
|
||||
|
||||
Reference in New Issue
Block a user