Mount external sources into a Sphinx build without copying or symlinking
Project description
Sphinx Mounts
Mount external source trees into a Sphinx build without copying or
symlinking. Sources stay where they live — for example, a Bazel bazel-bin/
output tree, a sibling repository, or a generated cache directory — and are
made visible to Sphinx at a configured docname prefix. RST works out of the
box; Markdown works as soon as myst-parser is loaded in the host project;
any other format a Sphinx parser extension registers is picked up the same
way.
Features
- No materialization: sources are read directly from their original location. No copy, no symlink, no staging step.
- Declarative TOML config: the mount mapping lives in
ubproject.toml(or any TOML file you name viamounts_from_toml).conf.pyonly references it. - Language-agnostic & toolable: because the config is static TOML, IDE
plugins, language servers, indexers, and build-system integrations
written in any language can read the same mount mapping that
sphinx-buildreads — without having to evaluateconf.py. - Toctree auto-wiring: an optional
attach_toper mount injects the bundle's entry doc into a host toctree at build time, so the host stays buildable when a mount is absent (a developer hasn't run the upstream build, CI hasn't fetched the bundle). - Self-contained bundles: each mount is intended to be a
self-contained tree of
.rstfiles with relative links only, so it can be reused across host projects. A linter is on the roadmap; the convention is not currently enforced.
Quick Start
pip install sphinx-mounts
Add to your conf.py:
extensions = ["sphinx_mounts"]
Describe your mounts in ubproject.toml next to conf.py:
[[mounts]]
dir = "/abs/path/to/bazel-bin/docs/api-foo"
mount_at = "_generated/api-foo"
Reference mounted documents from your host project just like any other doc:
.. toctree::
_generated/api-foo/index
Why TOML?
A conf.py is executable Python — only a Python interpreter can read it
correctly. A TOML file is static data, parseable by every common language.
Putting the mount mapping in ubproject.toml means that any external tool
(an IDE extension, a documentation indexer, a CI gate, a non-Python build
system) can resolve cross-references without running Sphinx. The same file
can also carry sections owned by sibling tools such as Sphinx-Needs
([needs]) and sphinx-codelinks ([codelinks]), keeping the project's
documentation configuration in one place.
If TOML isn't an option for your setup, the legacy mounts = [...] list in
conf.py is still honored as a fallback — see the docs for details.
Related projects
- bazel-drives-sphinx — a heavier take on Bazel-driven Sphinx
documentation: Bazel rules declare every RST file (and
needs.jsonartifact) as a label, and generated per-project targets invokesphinx-buildon the assembled tree.sphinx-mountsis the lightweight alternative — Bazel drops generated files underbazel-bin/, the extension mounts that directory, and Sphinx reads in place. Pick the former for fine-grained multi-project rule collection and tag-driven variants; pick the latter when "Bazel build, then Sphinx" is enough. Seedocs/source/bazel.rstfor a side-by-side comparison.
Documentation
See docs/source/ for the full configuration reference and the Bazel
integration walkthrough. The "Related projects" section in
docs/source/index.rst lists sibling tools (Sphinx-Needs,
sphinx-codelinks, ubCode, bazel-drives-sphinx) that share the
ubproject.toml convention.
License
MIT — see LICENSE.
Project details
Release history Release notifications | RSS feed
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_mounts-0.1.0.tar.gz.
File metadata
- Download URL: sphinx_mounts-0.1.0.tar.gz
- Upload date:
- Size: 18.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d1818e3a0b7e0b327c6fa265afcf4d43f5bb7147276e69a9b35cd046deeb9439
|
|
| MD5 |
babb4a3f1866b76833c34e0fdb3919da
|
|
| BLAKE2b-256 |
50433ed3fafb632fd168a62f8b9a1b5edc00e000802961f81dd4e922df946e60
|
Provenance
The following attestation bundles were made for sphinx_mounts-0.1.0.tar.gz:
Publisher:
release.yaml on useblocks/sphinx-mounts
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
sphinx_mounts-0.1.0.tar.gz -
Subject digest:
d1818e3a0b7e0b327c6fa265afcf4d43f5bb7147276e69a9b35cd046deeb9439 - Sigstore transparency entry: 1595216037
- Sigstore integration time:
-
Permalink:
useblocks/sphinx-mounts@1175baf9be245a2fdc3d64b7509840aec898d323 -
Branch / Tag:
refs/tags/0.1.0 - Owner: https://github.com/useblocks
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yaml@1175baf9be245a2fdc3d64b7509840aec898d323 -
Trigger Event:
push
-
Statement type:
File details
Details for the file sphinx_mounts-0.1.0-py3-none-any.whl.
File metadata
- Download URL: sphinx_mounts-0.1.0-py3-none-any.whl
- Upload date:
- Size: 18.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
aff3450756727d0ca43538ea72b67fddb8b8799c52110f41de8871c59d3d1540
|
|
| MD5 |
f33c2744b15df6f6e5a0ec6f69669cab
|
|
| BLAKE2b-256 |
5ea21318ed0af240e580d1b3c3f1e33708b8bb4fba91dfc0b3c9754b08ab337a
|
Provenance
The following attestation bundles were made for sphinx_mounts-0.1.0-py3-none-any.whl:
Publisher:
release.yaml on useblocks/sphinx-mounts
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
sphinx_mounts-0.1.0-py3-none-any.whl -
Subject digest:
aff3450756727d0ca43538ea72b67fddb8b8799c52110f41de8871c59d3d1540 - Sigstore transparency entry: 1595216126
- Sigstore integration time:
-
Permalink:
useblocks/sphinx-mounts@1175baf9be245a2fdc3d64b7509840aec898d323 -
Branch / Tag:
refs/tags/0.1.0 - Owner: https://github.com/useblocks
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yaml@1175baf9be245a2fdc3d64b7509840aec898d323 -
Trigger Event:
push
-
Statement type: