execnb
A description of your project
What it is and what it does
Execnb is a library for executing Jupyter notebook code outside a running Jupyter server. It provides CaptureShell, an async interface that runs notebook cells and captures their outputs in the standard Jupyter output format, without requiring Jupyter to be installed or running. This is useful for automating notebook execution, batch processing, or integrating notebook code into larger applications.
The package depends on fastcore and ipython, and offers both a programmatic async API and a command-line tool (exec_nb) for executing and saving notebooks with outputs. It's in pre-alpha status but actively maintained, with support for modern Python versions.
Use it for:
- Batch execute multiple notebooks and save results with outputs filled in.
- Integrate notebook execution into CI/CD pipelines or automated testing workflows.
- Run notebook code from a regular Python script or application without a Jupyter server.
- Programmatically inject code into notebooks before execution for parameterization.
- Generate documentation by executing and capturing outputs from example notebooks.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Executes Jupyter notebook code and captures outputs without running a Jupyter server, via an async API or command-line tool.
Yes, if you need to execute notebooks programmatically or in automation. The low install friction, active maintenance, permissive license, and lack of known vulnerabilities make it a safe choice. Pre-alpha status means the API may change, so pin the version if stability is critical.
Install
execnb on PyPI
pip
pip install execnbuv
uv add execnbpoetry
poetry add execnbInstalling execnb
Before you install
Low install friction with only two runtime dependencies (fastcore and ipython). Active maintenance with a recent release (4 days ago) and steady repository activity.
License in practice
Apache-2.0 permissive license allows commercial and private use with minimal restrictions, making it suitable for most projects.
Quickstart
pip install execnb
from execnb.shell import CaptureShell
import asyncio
s = CaptureShell()
result = asyncio.run(s.run('1+1'))
print(result)
Requires Python 3.7 or later; async API requires either an async context (notebook/async code) or wrapping in asyncio.run() at sync entry points.
Verify before relying
- Whether CaptureShell handles all Jupyter magic commands and cell types correctly.
- Performance characteristics when executing large or long-running notebooks.
- Compatibility with specific notebook features (widgets, display objects, etc.).
Package facts
| License | Apache-2.0 (permissive) |
| Python support | supports the current Python release (>=3.7) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 2 — fastcore, ipython |
| Maintenance | actively maintained — 4 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 103,231/month — #12,820 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: execnb-0.3.2-py3-none-any.whl
Keywords: some, keywords
Tags
More Software Development packages
Provides backported and experimental type hints…
permissive · top 100 on PyPI
numpyNumPy provides an N-dimensional array object…
permissive · top 100 on PyPI
fastapiFastAPI is a Python web framework for building…
permissive · top 100 on PyPI
annotated-docProvides a way to document function parameters,…
permissive · top 100 on PyPI
typerTyper builds command-line applications from…
permissive · top 1,000 on PyPI
distlibDistlib provides low-level packaging utilities…
permissive · top 1,000 on PyPI
nbdevnbdev is a notebook-driven development platform…
permissive · top 15,000 on PyPI
nb-cleannb-clean removes execution counts, metadata,…
permissive · top 15,000 on PyPI
nbmakeA pytest plugin that executes Jupyter notebooks…
permissive · top 15,000 on PyPI
jupyter-nbmodel-clientProgrammatically interact with live Jupyter…
permissive · top 15,000 on PyPI
nbvalA pytest plugin that treats Jupyter notebooks…
permissive · top 15,000 on PyPI
papermillPapermill parameterizes, executes, and analyzes…
permissive · top 5,000 on PyPI
nbclientnbclient executes Jupyter notebooks…
permissive · top 1,000 on PyPI
jupyter-cacheCaches Jupyter notebook execution outputs to…
permissive · top 5,000 on PyPI
jupyter-ui-pollBlocks Jupyter cell execution while waiting for…
permissive · top 15,000 on PyPI
wurlitzerCaptures C-level stdout and stderr output in…
permissive · top 5,000 on PyPI