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
| Name | Description | Type | Mandatory | Default |
|---|---|---|---|---|
| name | A unique name for this target. | Name | required | |
| deps | Python dependencies required by the notebook. These are typically Python packages needed for code execution. | List of labels | optional | [] |
| src | The notebook source file. Can be either a .ipynb file or a .py file in Jupytext format (with # %% cell markers). | Label | required | |
| data | Additional data files required by the notebook (e.g., input data files, images, configuration files). | List of labels | optional | [] |
| kernel | The 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. | String | optional | "" |