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 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.

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

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. 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.2.1

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.2.1
File Size Uploaded Provenance
sphinx_lens-0.2.1.tar.gz 20.2 kB With provenance Details

Built distribution (wheel)

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

Total release size: 43.5 kB

Release files / sphinx_lens-0.2.1.tar.gz

Download URL sphinx_lens-0.2.1.tar.gz
Size 20.2 kB
Tags Source
SHA-256 checksum
How to use checksums
38d6bdb5bae1714153380d0cd66f351be0f330a6dce1a3e6a688ed4879274388
BLAKE2b-256 checksum
How to use checksums
15d88c8c50cf97ca9b6d74a8469297e4393ba0863ee0778946f57cc394a3a876
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.12.15 {"installer":{"name":"uv","version":"0.12.15","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}

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 Sep 17, 2026.

Transparency log

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

Download URL sphinx_lens-0.2.1-py3-none-any.whl
Size 23.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
a727bbeb89bf79a1201cf09d6438a16b122de28a2be59f524cab0a5999624636
BLAKE2b-256 checksum
How to use checksums
b386bcdf99fc83f30243ddf6309125b385d080f9c2a3e3e5e5f5a9eb1db32033
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.12.15 {"installer":{"name":"uv","version":"0.12.15","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}

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 Sep 17, 2026.

Transparency log

Security for sphinx-lens 0.2.1

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

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for sphinx_lens-0.2.1.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 Sep 17, 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.

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