New to Kestra?
Use blueprints to kickstart your first workflows.
Execute and parameterize Jupyter notebooks with Papermill inside a Kestra Python task, capture the executed notebook as an output, and orchestrate it on a schedule.
id: papermill-notebook
namespace: company.team
tasks:
- id: python
type: io.kestra.plugin.scripts.python.Commands
namespaceFiles:
enabled: true
beforeCommands:
- pip install ipykernel papermill
- python -m ipykernel install --name python3.12.0
commands:
- papermill src/example.ipynb.py output.ipynb -k python3.12.0
outputFiles:
- output.ipynb
Run a Jupyter notebook as a first-class, reproducible step in a data pipeline using Papermill inside a Kestra Python task. Notebooks are great for analysis and prototyping, but they are hard to operationalize: they sit on a laptop, run interactively, and leave no record of what executed. This blueprint solves that by executing a notebook headlessly with Papermill, capturing the fully rendered output notebook as a Kestra output artifact, and making the whole run versioned, observable, and ready to schedule.
The flow has a single io.kestra.plugin.scripts.python.Commands task named python.
namespaceFiles is enabled, so the notebook stored in your namespace under src/example.ipynb.py is synced into the task working directory.beforeCommands install the runtime dependencies: pip install ipykernel papermill, then register a Jupyter kernel with python -m ipykernel install --name python3.12.0.papermill src/example.ipynb.py output.ipynb -k python3.12.0 executes the input notebook cell by cell against that kernel and writes the rendered result to output.ipynb.outputFiles captures output.ipynb, so the executed notebook (with all cell outputs and results inlined) is stored as a downloadable Kestra output.output.ipynb saved as a Kestra output artifact for audit and review.python3.12.0) so runs are reproducible.beforeCommands, keeping the environment explicit.Papermill executes a notebook but does not schedule it, retry it, or track its history. Kestra adds event and schedule triggers, automatic retries on failure, execution-level outputs and lineage, and a declarative YAML definition you can version in Git. The executed notebook is captured as an output rather than left on disk, and Namespace Files keep the notebook source synced without manual copying. That is the operational layer Papermill alone cannot provide.
pip install packages.src/example.ipynb.py.This flow references no secrets. Add them with {{ secret('NAME') }} only if your notebook needs credentials to reach external systems.
src/example.ipynb.py.python task install dependencies and run Papermill.output.ipynb from the execution outputs to review the rendered notebook.-p name value to parameterize each run.io.kestra.plugin.core.trigger.Schedule trigger to run the notebook on a cron schedule.jupyter nbconvert to publish an HTML or PDF report.output.ipynb to object storage or send a notification when the run completes.