or run

npx @tessl/cli init
Log in

Version

Tile

Overview

Evals

Files

docs

cleaning.mdconfiguration.mddevelopment-tools.mddocumentation.mdexport.mdgit-integration.mdindex.mdrelease-management.mdsynchronization.mdtesting.md
tile.json

tessl/pypi-nbdev

Create delightful software with Jupyter Notebooks

Workspace
tessl
Visibility
Public
Created
Last updated
Describes
pypipkg:pypi/nbdev@2.4.x

To install, run

npx @tessl/cli install tessl/pypi-nbdev@2.4.0

index.mddocs/

nbdev

nbdev is a notebook-driven development platform that enables developers to create high-quality software packages directly from Jupyter notebooks. It provides comprehensive tooling for automatic documentation generation, seamless publishing to PyPI and conda repositories, two-way synchronization between notebooks and plain-text source code, parallel test execution, built-in continuous integration, and git-friendly notebook handling.

Package Information

  • Package Name: nbdev
  • Language: Python
  • Installation: pip install nbdev

Core Imports

import nbdev
from nbdev import nbdev_export, show_doc

Common workflow imports:

from nbdev.config import get_config, nbdev_create_config
from nbdev.export import nb_export
from nbdev.test import nbdev_test
from nbdev.clean import nbdev_clean

Basic Usage

import nbdev
from nbdev.config import get_config, nbdev_create_config
from nbdev.export import nb_export

# Create a new nbdev project
nbdev_create_config()

# Get current configuration
config = get_config()
print(f"Project: {config.lib_name}")
print(f"Version: {config.version}")

# Export notebooks to Python modules
nb_export()

Architecture

nbdev is built around several key architectural components:

  • Configuration System: Centralized settings management through settings.ini files
  • Notebook Processing Pipeline: Extensible system for transforming notebook cells
  • Export Engine: Converts notebook cells to Python modules with proper structure
  • Documentation Generator: Automatic API documentation from notebook content
  • Testing Framework: Execute test cells in parallel across notebooks
  • Git Integration: Handles notebook metadata and merge conflicts
  • CLI Tools: Command-line interface for all major operations

The processing pipeline uses a processor pattern where notebooks pass through configurable stages (processors) that can transform, validate, or extract information from cells.

Capabilities

Project Configuration

Project setup, configuration management, and bootstrapping functionality for new nbdev projects.

def nbdev_create_config(
    repo: str = None,
    branch: str = None,
    user: str = None,
    author: str = None,
    author_email: str = None,
    description: str = None,
    path: str = '.',
    cfg_name: str = 'settings.ini',
    **kwargs
): ...
def get_config(cfg_name: str = 'settings.ini', path=None): ...
def config_key(c, default=None, path=True, missing_ok=None): ...  # Deprecated
def is_nbdev() -> bool: ...

Configuration

Notebook Export

Convert Jupyter notebook cells to Python modules with proper imports, documentation, and structure.

def nb_export(
    nbname: str,
    lib_path: str = None,
    procs=None,
    name: str = None,
    mod_maker=ModuleMaker,
    debug: bool = False,
    solo_nb: bool = False
): ...
def black_format(cell, force: bool = False): ...
class ExportModuleProc: ...

Export

Documentation Generation

Generate comprehensive API documentation and create documentation sites from notebooks.

def nbdev_export(path: str = None, procs=["black_format"], **kwargs): ...
def show_doc(sym, renderer=None, name: str = None, title_level: int = 3): ...
def create_index(url, pre=None): ...
class NbdevLookup(strip_libs=None, incl_libs=None, skip_mods=None, ns=None): ...

Documentation

Testing Framework

Run tests defined in notebook cells across your project in parallel.

def nbdev_test(
    path: str = None,
    flags: str = '',
    n_workers: int = None,
    timing: bool = False,
    do_print: bool = False,
    pause: float = 0.01,
    ignore_fname: str = '.notest',
    **kwargs
): ...
def test_nb(
    fn,
    skip_flags=None,
    force_flags=None,
    do_print: bool = False,
    showerr: bool = True,
    basepath=None
): ...

Testing

Notebook Cleaning

Clean notebook metadata, outputs, and configure git integration for notebooks.

def nbdev_clean(
    fname: str = None,
    clear_all: bool = False,
    disp: bool = False,
    stdin: bool = False
): ...
def clean_nb(
    nb,
    clear_all: bool = False,
    allowed_metadata_keys: list = None,
    allowed_cell_metadata_keys: list = None,
    clean_ids: bool = True
): ...
def nbdev_trust(fname: str = None, force_all: bool = False): ...
def nbdev_install_hooks(): ...

Cleaning

Code Synchronization

Synchronize between notebooks and plain Python source code for IDE compatibility.

def nbdev_update(fname: str = None): ...
def absolute_import(name, fname, level): ...

Synchronization

Git Integration

Handle git merge conflicts and notebook-specific version control concerns.

def nbdev_merge(base: str, ours: str, theirs: str, path: str): ...
def nbdev_fix(
    nbname: str,
    outname: str = None,
    nobackup: bool = True,
    theirs: bool = False,
    noprint: bool = False
): ...
def unpatch(s: str): ...

Git Integration

Release Management

Automated publishing to PyPI, GitHub releases, and changelog generation.

class Release(owner=None, repo=None, token=None, **groups): ...
def release_git(token: str = None): ...
def release_gh(token: str = None): ...
def changelog(debug: bool = False, repo: str = None): ...

Release Management

Development Tools

Development server, project migration, and various utility functions.

def nbdev_new(**kwargs): ...
def nbdev_migrate(path: str = None, no_skip: bool = False): ...
def proc_nbs(
    path: str = '',
    n_workers: int = None,
    force: bool = False,
    file_glob: str = '',
    file_re: str = '',
    **kwargs
): ...

Development Tools

Command Line Interface

nbdev provides comprehensive CLI commands:

# Create new project
nbdev_new

# Export notebooks to modules  
nbdev_export

# Run tests
nbdev_test

# Clean notebooks
nbdev_clean

# Install git hooks
nbdev_install_hooks

# Update from source
nbdev_update

# Merge conflicts
nbdev_merge

# Trust notebooks
nbdev_trust