jupyter_notebook_test
Rules
jupyter_notebook_test
load("@rules_jupyter//jupyter:jupyter_notebook_test.bzl", "jupyter_notebook_test")
jupyter_notebook_test(name, data, cwd_mode, env, env_inherit, exporter_args, notebook, reports)
A test rule that executes a Jupyter notebook and optionally generates reports. The test fails if any notebook cell raises an error.
ATTRIBUTES
| Name | Description | Type | Mandatory | Default |
|---|---|---|---|---|
| name | A unique name for this target. | Name | required | |
| data | Additional data files required by the notebook (e.g., input data files, images, configuration files). | List of labels | optional | [] |
| cwd_mode | The working directory mode for notebook execution. If not specified, uses the toolchain's default_cwd. | String | optional | "" |
| env | Environment variables to set when executing the notebook. Values support location expansion (e.g., $(location :target)). | Dictionary: String -> String | optional | {} |
| env_inherit | Specifies additional environment variables to inherit from the external environment when the test is executed by bazel test. | List of strings | optional | [] |
| exporter_args | Traitlets-style flags forwarded to nbconvert exporters (e.g. --WebPDFExporter.exclude_input=true). | List of strings | optional | [] |
| notebook | The notebook to execute and test. Must be a jupyter_notebook target. | Label | required | |
| reports | List of report types to generate after successful notebook execution. Valid values: 'html', 'markdown', 'latex'. | List of strings | optional | ["webpdf"] |