Skip to main content

Sphinx Lens

CI docs pypi version Changelog Ruff ty License

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 SQLite 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. An optional MCP Streamable HTTP server exposes the same queries as tools.

Each scope remains separately addressable. Consumers can retrieve the relevant part of the documentation without loading a whole-site text export or recovering structure from generated HTML.

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"
sphinx-lens inspect py:class:example.Client
sphinx-lens read guide/network#timeouts
sphinx-lens links guide/network#timeouts
sphinx-lens --mcp

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.sqlite. Query commands discover that index from the repository root or anywhere inside the Sphinx source tree. Run sphinx-lens build from the repository to discover conf.py and create the index without spelling out the source directory.

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 uv cooldown ([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 prek as 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 with make docs.

Metadata

Release files for sphinx-lens 0.4.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for sphinx-lens 0.4.0
File Size Uploaded Provenance Actions
sphinx_lens-0.4.0.tar.gz 27.0 kB With provenance Details for sphinx_lens-0.4.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for sphinx-lens 0.4.0
File Interpreter ABI Platform Actions
sphinx_lens-0.4.0-py3-none-any.whl Python 3 none any Details for sphinx_lens-0.4.0-py3-none-any.whl

Total release size: 56.4 kB

Release files / sphinx_lens-0.4.0.tar.gz

Download URL sphinx_lens-0.4.0.tar.gz
Size 27.0 kB
Tags Source
SHA-256 checksum
How to use checksums
24a522e8ceaf5aff15ac76e00ba410e6120e60fb49662003f5d1baec6f99504f
BLAKE2b-256 checksum
How to use checksums
915bf836725dc07df3f488e65faf3d282de01d2cd6eb011cc840a131b483e134
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.13.7 {"installer":{"name":"uv","version":"0.13.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 4, 2026.

Transparency log

Release files / sphinx_lens-0.4.0-py3-none-any.whl

Download URL sphinx_lens-0.4.0-py3-none-any.whl
Size 29.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
72ab76f59d064a88ab25789d0cd1ca7eadd5da5c9d84d52fc2052a81522b1815
BLAKE2b-256 checksum
How to use checksums
798ea83200b3e73ecf7fbb12c66be408ba8b2774640912e17ac045fde9ffe279
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.13.7 {"installer":{"name":"uv","version":"0.13.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 4, 2026.

Transparency log

Security for sphinx-lens 0.4.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for sphinx_lens-0.4.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 4, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page