Files
oc/clis/docs.python.org.json
T
only-cli e834309363 prototype a Sphinx search backend for the Python docs
docs.python.org has no search server: its search page downloads the
whole Sphinx index (searchindex.js, ~900KB gzipped) and ranks matches
in the browser. oc now does the same ranking itself, so 'oc py search'
answers from the site's own index instead of DuckDuckGo.

The index is cached on disk for a day and never printed; what renders
is a numbered result list that rides the normal open path, so 'do <n>'
follows a result. A query that names a symbol exactly (json.dumps)
links straight to its anchor. A site definition opts in with a
'sphinx' field naming the docs root, so any Sphinx site can use the
backend later.
2026-08-24 09:59:34 -04:00

9 lines
311 B
JSON

{
"domain": "docs.python.org",
"commands": {
"library": { "open": "https://docs.python.org/3/library/{module}.html", "args": ["module"] },
"doc": { "open": "https://docs.python.org/3/{path}.html", "args": ["path"] },
"search": { "sphinx": "https://docs.python.org/3/", "args": ["query"] }
}
}