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 viasources_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. - Variant-gated source selection: sphinx-mounts is also the Sphinx-side
reader for the shared
ubproject.tomlkeys that decide which files are in the build for the current variant —[[source.variant_sources]], which narrows a file set by glob, andifon a[[source.mounts]]entry, which gates a whole mounted bundle. A project with no mounts at all can install it purely for the first, to havesphinx-buildnarrow its document set the way ubCode already does. - 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:
[[source.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/bazel.rstfor a side-by-side comparison.
Documentation
See docs/ for the full configuration reference and the Bazel
integration walkthrough. The "Related projects" section in
docs/index.rst lists sibling tools (Sphinx-Needs,
sphinx-codelinks, ubCode, bazel-drives-sphinx) that share the
ubproject.toml convention.
License
MIT — see LICENSE.
Metadata
Release files for sphinx-mounts 0.3.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| sphinx_mounts-0.3.1.tar.gz | 99.4 kB | Without provenance | Details for sphinx_mounts-0.3.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| sphinx_mounts-0.3.1-py3-none-any.whl | Python 3 | none | any | Details for sphinx_mounts-0.3.1-py3-none-any.whl |
Total release size: 201.8 kB
Release files / sphinx_mounts-0.3.1.tar.gz
| Download URL | sphinx_mounts-0.3.1.tar.gz |
|---|---|
| Size | 99.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
a3165e6d8ba16c22bdd00054a9dec86511da2f22ad078a4ddb946615b254ba82
|
|
BLAKE2b-256 checksum How to use checksums |
918ea575b55acd7476874dfdcc734572d7b93b62debad8314c0b5a5eda082323
|
| 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}
|
Release files / sphinx_mounts-0.3.1-py3-none-any.whl
| Download URL | sphinx_mounts-0.3.1-py3-none-any.whl |
|---|---|
| Size | 102.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
1049378b32f631a3191f799da9cf5436b9e0fec140aa4875be37abeb65e2af42
|
|
BLAKE2b-256 checksum How to use checksums |
1cd285a7ef6e59d41dd705b04c57f57412741993862e7c58caa0a131e9e00d28
|
| 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}
|
Security for sphinx-mounts 0.3.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.
No provenance found
None of the files in this release were uploaded with provenance metadata.
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.