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.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

sphinx_lens-0.1.1.tar.gz (16.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

sphinx_lens-0.1.1-py3-none-any.whl (19.5 kB view details)

Uploaded Python 3

File details

Details for the file sphinx_lens-0.1.1.tar.gz.

File metadata

  • Download URL: sphinx_lens-0.1.1.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

Hashes for sphinx_lens-0.1.1.tar.gz
Algorithm Hash digest
SHA256 63b9ecb379d09962bd7e1163fba525047496714c5873115676e579b030ac3e5c
MD5 7e1a8a9ad01e4b3d1bbf38d6a640541d
BLAKE2b-256 061a3718b12c66a58e4204b39a9d559f888a09222deb56d467f4d1f52b76e232

See more details on using hashes here.

Provenance

The following attestation bundles were made for sphinx_lens-0.1.1.tar.gz:

Publisher: cd.yml on mgaitan/sphinx-lens

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file sphinx_lens-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: sphinx_lens-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 19.5 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

Hashes for sphinx_lens-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 3a66d375a8bb446d2226d4f76c3aa8027ca79200e8d7aa566600d4dd293c8060
MD5 f4d2e9b1368ffd5742e8d06313ae92f3
BLAKE2b-256 864e6504e4f0887ac5abc1529a140bf991b69092321fc009b4c9dfe9cf02a5a9

See more details on using hashes here.

Provenance

The following attestation bundles were made for sphinx_lens-0.1.1-py3-none-any.whl:

Publisher: cd.yml on mgaitan/sphinx-lens

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 files

0.1.0

2 files

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