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
html_js_files = [
("https://kilnvm.dev/kilnvm-embed.js", {"defer": "defer"}),
]
2. Seed Files, Run Buttons & Production Tips
.. 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
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.
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.
Ship live CLI sandboxes inside your docs.
Start free with 300 sessions per month, isolated linux/amd64 microVMs, and zero credit card required.