How treebeardtech/nbmake works
nbmake is a pytest plugin that discovers selected Jupyter notebooks, executes them, and reports notebook failures as pytest failures. The main path runs from pytest options and collection through a notebook item into execution and result formatting; optional notebook overwrite is handled by the item. Execution supports README-documented timeout, kernel, import-error, cell-mocking, and post-cell hooks. Parallel execution via pytest-xdist is a documented capability, but its internal integration is not shown in the sampled source.
Main entry points: pytest_items.py Notebook item · nb_run.py Notebook execution · pytest_plugin.py Plugin hooks · nb_result.py Execution result
Components 11
Pytest integration
- Plugin hooks
src/nbmake/pytest_plugin.py - Notebook collection
src/nbmake/pytest_items.py - Notebook item
src/nbmake/pytest_items.py
Notebook runtime
- Notebook execution
src/nbmake/nb_run.py - nbclient engine
Result reporting
- Execution result
src/nbmake/nb_result.py - Failure formatting
src/nbmake/pytest_items.py
Other components
- Pytest user
- Notebook file
- Jupyter kernel
- pytest-xdist
Connections 12
- Pytest user → Plugin hooks: sets options
README.md - Plugin hooks → Notebook collection: collects notebooks
src/nbmake/pytest_plugin.py - Notebook collection → Notebook item: creates item
src/nbmake/pytest_items.py - Notebook item → Notebook file: reads or overwrites
src/nbmake/pytest_items.py - Notebook item → Notebook execution: executes
src/nbmake/pytest_items.py - Notebook execution → Notebook file: loads notebook
src/nbmake/nb_run.py - Notebook execution → nbclient engine: executes cells
src/nbmake/nb_run.py - nbclient engine → Jupyter kernel: runs code
- Notebook execution → Execution result: returns result
src/nbmake/nb_run.py - Notebook item → Execution result: checks result
src/nbmake/pytest_items.py - Notebook item → Failure formatting: formats failures
src/nbmake/pytest_items.py - Pytest user → pytest-xdist: parallelizes tests
README.md