Sphinx & Read the Docs Integration Guide

Embed a live Linux CLI terminal in Sphinx & Read the Docs

Sphinx and Read the Docs drive much of the Python, scientific computing, and MLOps ecosystem. Register kilnvm-embed.js once in conf.py and mount live Click-to-Run containers directly inside reStructuredText (reST) or MyST Markdown pages.

1. Add KilnVM to Sphinx & Read the Docs

docs/source/conf.py (load embed runtime globally)
html_js_files = [
    ("https://kilnvm.dev/kilnvm-embed.js", {"defer": "defer"}),
]

2. Seed Files, Run Buttons & Production Tips

quickstart.rst (reST) or quickstart.md (MyST Markdown)
.. raw:: html

   <div
     data-kilnvm-project="proj_your_project_id"
     data-kilnvm-theme="auto"
     data-kilnvm-cmd="mycli check config.yaml"
     data-kilnvm-file="config.yaml"
     data-kilnvm-file-content="mode: strict"
   ></div>
  • Works identically on Furo, PyData Sphinx Theme, and sphinx-rtd-theme; data-kilnvm-theme="auto" tracks dark-mode toggles cleanly.
  • Because sandboxes run real linux/amd64 Python wheels and C extensions on server microVMs, tools like DuckDB, NumPy, and compiled extensions run natively unlike browser WASM shims.
  • Add your *.readthedocs.io staging URL alongside your custom docs domain under Allowed Docs Origins in Project Settings.

3. Try a Live Sandbox Right Now

Click Launch Terminal below to boot a real non-root Linux microVM directly in the page.

Frequently Asked Questions

Do I need Sphinx extensions or custom directives if I use MyST Markdown?

No. With MyST Markdown, standard HTML blocks like <div data-kilnvm-project="..."></div> render directly without extra extensions once conf.py loads kilnvm-embed.js.

Can visitors install arbitrary pip packages inside my free sandbox?

Free and Pro sandboxes disable outbound internet by default (Scale allows allowlisted HTTPS hosts), so readers run the exact Python packages baked into your container image safely.

Ready in 5 minutes

Ship live CLI sandboxes inside your docs.

Start free with 300 sessions per month, isolated linux/amd64 microVMs, and zero credit card required.