Blueprints

Run a Papermill notebook

About this blueprint

Namespace Files Python

This blueprint shows how to execute a Jupyter Notebook within a Kestra flow using the Papermill library.

Here we use Namespace Files where we created the src/example.ipynb.py notebook. We expose the outputs of the notebook execution into the output.ipynb file.

yaml
id: papermill_notebook
namespace: blueprint

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

Commands

More Related Blueprints

New to Kestra?

Use blueprints to kickstart your first workflows.

Get started with Kestra