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" --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 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.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.2.0
File Size Uploaded Provenance
sphinx_lens-0.2.0.tar.gz 19.4 kB With provenance Details

Built distribution (wheel)

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

Total release size: 41.7 kB

Release files / sphinx_lens-0.2.0.tar.gz

Download URL sphinx_lens-0.2.0.tar.gz
Size 19.4 kB
Tags Source
SHA-256 checksum
How to use checksums
59d5b48b3420928f0627e07debae26ee58d24858f92b48973ea66455008a68d9
BLAKE2b-256 checksum
How to use checksums
0eadc038f63da73660456b11d02687b87c4b5c8b424f4e49ec95466f26218f9a
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.0-py3-none-any.whl

Download URL sphinx_lens-0.2.0-py3-none-any.whl
Size 22.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
1676f5c4f0517c7ea5df2f4d6b173662a375dddd38198210997914150f76d209
BLAKE2b-256 checksum
How to use checksums
e6711d425b39cf652a8cdf548b455cdd3d4cd8e2355a1979305f40dbbac78b41
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.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

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

Select from 2 files

Attestation for sphinx_lens-0.2.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 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