jupyter_notebook

Rules

jupyter_notebook

load("@rules_jupyter//jupyter:jupyter_notebook.bzl", "jupyter_notebook")

jupyter_notebook(name, deps, src, data, kernel)

Compiles a Jupyter notebook from source and prepares it for execution.

This rule processes notebook source files and converts them to the standard .ipynb format. If the source is a .py file in Jupytext format (with # %% cell markers), it will be converted to .ipynb format. If the source is already a .ipynb file, it is used directly.

Example:

jupyter_notebook(
    name = "my_notebook",
    src = "notebook.py",  # or "notebook.ipynb"
    kernel = "python3",   # optional
    deps = ["@pip_deps//polars"],
    data = ["data.csv"],
)

ATTRIBUTES

NameDescriptionTypeMandatoryDefault
nameA unique name for this target.Namerequired
depsPython dependencies required by the notebook. These are typically Python packages needed for code execution.List of labelsoptional[]
srcThe notebook source file. Can be either a .ipynb file or a .py file in Jupytext format (with # %% cell markers).Labelrequired
dataAdditional data files required by the notebook (e.g., input data files, images, configuration files).List of labelsoptional[]
kernelThe name of the Jupyter kernel to use for executing the notebook (e.g., python3, rust). If not specified, the default kernel from the toolchain is used.Stringoptional""