Sphinx Lens
Structure-aware indexing and precise navigation for Sphinx documentation.
Sphinx knows things about your documentation that nothing downstream gets to
use: which text belongs to which section, that django.db.transaction.atomic is
a documented object with a canonical name, and where every cross-reference
points. Then it renders HTML and throws that away.
Sphinx Lens is a Sphinx builder that writes it down instead. The output is a single JSON index of documents, sections, and domain objects, each with a stable reference and its own scoped text, plus the compiled link graph between them. Coding agents get to read one precise scope instead of grepping a source tree.
Quick start
Install Sphinx Lens in the same environment as your documentation and build the index like any other Sphinx artifact:
sphinx-build -b lens docs/ docs/_build/lens/
sphinx-lens locate "connection timeout" --index docs/_build/lens/
sphinx-lens inspect py:class:example.Client --index docs/_build/lens/
sphinx-lens read guide/network#timeouts --index docs/_build/lens/
sphinx-lens links guide/network#timeouts --index docs/_build/lens/
The lens builder is discovered through Sphinx's builder entry point; no
conf.py change is required. It loads the project's formats, extensions, and
domains, then writes docs/_build/lens/index.json. Projects can expose this as
make lens; sphinx-lens build docs/ is the equivalent convenience command.
Sphinx executes conf.py during every build. Only index projects you trust, and
run the command in the project's documentation environment so MyST, autodoc,
themes, and project-specific extensions are importable.
Install the bundled agent skill with Library Skills:
uvx library-skills install --skill sphinx-lens --yes
locate is lexical. It finds the right reference so that read and links can
do the real work; embedding similarity is out of scope.
Full documentation is at https://mgaitan.github.io/sphinx-lens/. Start with
Getting started, or read
How it works for why this is a separate artifact rather than a
reuse of objects.inv, searchindex.js, or Sphinx doctrees.
Development
- Install dependencies with
uv sync. - New dependency releases are delayed by one week via
uvcooldown ([tool.uv].exclude-newer = "1 week"), with per-package overrides when required (for example,ty). - Make targets and GitHub Actions enable uv's malware check against known malicious-package advisories.
- Install
prekas an external tool:
uv tool install prek
- Install git hooks with
prek:
prek install
- Run the local QA bundle with
prek:
prek run --all-files
- PRs with documentation changes publish a docs preview at:
https://mgaitan.github.io/sphinx-lens/_preview/pr-<PR_NUMBER>/
- Build this project's own index with
make lens, and the docs withmake docs.
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file sphinx_lens-0.1.0.tar.gz.
File metadata
- Download URL: sphinx_lens-0.1.0.tar.gz
- Upload date:
- Size: 16.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
uv/0.12.3 {"installer":{"name":"uv","version":"0.12.3","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1ce6e54e05186fc00bdacee3316e7de8f17a496d8b95d4caca8d553f75971132
|
|
| MD5 |
f60faad7a88e5d985928661ae1443ca6
|
|
| BLAKE2b-256 |
273172b587df9b72dea8cd7fd9e14d479035f814117c1647ba5185083ff2d61f
|
Provenance
The following attestation bundles were made for sphinx_lens-0.1.0.tar.gz:
Publisher:
cd.yml on mgaitan/sphinx-lens
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
sphinx_lens-0.1.0.tar.gz -
Subject digest:
1ce6e54e05186fc00bdacee3316e7de8f17a496d8b95d4caca8d553f75971132 - Sigstore transparency entry: 2388018616
- Sigstore integration time:
-
Permalink:
mgaitan/sphinx-lens@a645e78123ff919dd057cee0ce284d34242f73c6 -
Branch / Tag:
refs/tags/0.1.0 - Owner: https://github.com/mgaitan
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
cd.yml@a645e78123ff919dd057cee0ce284d34242f73c6 -
Trigger Event:
release
-
Statement type:
File details
Details for the file sphinx_lens-0.1.0-py3-none-any.whl.
File metadata
- Download URL: sphinx_lens-0.1.0-py3-none-any.whl
- Upload date:
- Size: 19.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
uv/0.12.3 {"installer":{"name":"uv","version":"0.12.3","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fc363ca5f0b2864109471aad445a479e0b8a45f5bc1fa1997673e585db5883b2
|
|
| MD5 |
73a0fe1c4d80b4791265ee2b4e59a0ed
|
|
| BLAKE2b-256 |
4f1b7e102ea03005d28078bc1271ccc7eb4d427ed142b458f97711e7f028c693
|
Provenance
The following attestation bundles were made for sphinx_lens-0.1.0-py3-none-any.whl:
Publisher:
cd.yml on mgaitan/sphinx-lens
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
sphinx_lens-0.1.0-py3-none-any.whl -
Subject digest:
fc363ca5f0b2864109471aad445a479e0b8a45f5bc1fa1997673e585db5883b2 - Sigstore transparency entry: 2388018639
- Sigstore integration time:
-
Permalink:
mgaitan/sphinx-lens@a645e78123ff919dd057cee0ce284d34242f73c6 -
Branch / Tag:
refs/tags/0.1.0 - Owner: https://github.com/mgaitan
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
cd.yml@a645e78123ff919dd057cee0ce284d34242f73c6 -
Trigger Event:
release
-
Statement type: