nbdev: Notebook Driven Development

3.0.15 · active · verified Fri Apr 17

nbdev is a Python library that enables a complete literate programming environment, allowing users to develop, test, document, and deploy software using Jupyter Notebooks. It leverages Quarto for powerful documentation generation and provides a robust command-line interface for managing the development workflow. Currently at version 3.0.15, nbdev maintains a rapid release cadence, frequently pushing minor updates and bug fixes.

Common errors

Warnings

Install

Imports

Quickstart

This quickstart demonstrates the typical nbdev CLI workflow: creating a new project, exporting notebook code to Python modules, running tests, and generating documentation. Remember to manually create/edit a notebook file with '#|export' cells before running `nbdev_export`.

# 1. Create a new nbdev project (run in your terminal)
nbdev_new --user "Your Name" --email "your@example.com" --repo-path my_nbdev_project --git-url "https://github.com/your-username/my_nbdev_project" --lib-name my_nbdev_project
cd my_nbdev_project

# 2. Open 00_core.ipynb (or create a new notebook like `01_utils.ipynb`)
# Add a cell with `#|export` at the top and define a function:
# #|export
# def greet(name):
#     "Returns a personalized greeting"
#     return f"Hello, {name}!"

# 3. Export your notebooks to Python modules
nbdev_export

# 4. Test your library
nbdev_test

# 5. Generate documentation (requires Quarto CLI installed separately)
# nbdev_docs serve # To build and serve docs locally

view raw JSON →