sphinx-mounts

Mount external source trees into a Sphinx build without copying or symlinking. The sources stay where they live; Sphinx reads them in place under a configured docname prefix. Any format Sphinx knows how to parse is supported — .rst out of the box, .md via myst-parser, plus anything else a parser extension registers.

Two external source bundles (one under bazel-out/, one in a sibling directory outside the docs folder) appear in the host Sphinx project as virtual mount slots (docs/api/, docs/shared/) declared by [[mounts]] entries in ubproject.toml. A second arrow shows ubproject.toml driving the toctree attachment in index.rst.

[[mounts]] entries in ubproject.toml map external directories onto docname slots in the host project. Those slots (docs/api/, docs/shared/) do not exist on disk — sphinx-mounts populates them virtually and the host’s index.rst toctree attaches them into the build.

Use cases:

  • Build-system-generated docs (Bazel, Buck2, Pants) where outputs land in directories outside srcdir and you do not want a staging step.

  • Mono-repo doc bundles owned by different teams and consumed by a host project.

  • Generated API references produced by a sibling tool whose output is pure RST.

  • Distributed Markdown files living next to the code they document — README.md files in each subpackage of a monorepo, design notes in sibling repositories, release notes generated under dist/ — pulled into a single Sphinx documentation build without copying. Works as soon as myst_parser is loaded; see Source formats: RST, Markdown, and anything Sphinx knows about.

Note

Beta software. sphinx-mounts is in early beta. The configuration shape, mount semantics, and edge-case behavior may still change before 1.0. Feedback on the mount mechanism — what works, what surprises you, what is missing — is very much appreciated; please open an issue at github.com/useblocks/sphinx-mounts/issues.