feat: funciones Bash — install_nbconvert, notebook_to_pdf, export_analysis_pdfs

Infra: install_nbconvert (instala nbconvert+deps), notebook_to_pdf (convierte .ipynb a PDF).
Pipeline: export_analysis_pdfs (exporta todos los notebooks de analysis/ a PDF).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-04-05 17:11:57 +02:00
parent af1fa129f7
commit ac05aa489c
6 changed files with 281 additions and 0 deletions
@@ -0,0 +1,48 @@
---
name: export_analysis_pdfs
kind: pipeline
lang: bash
domain: pipelines
version: "1.0.0"
purity: impure
signature: "export_analysis_pdfs(nombre: string, [pattern: string]) -> void"
description: "Exporta todos los notebooks de un analisis Jupyter a PDF. Instala nbconvert y playwright automaticamente si no estan presentes."
tags: [pipeline, jupyter, pdf, export, nbconvert, launcher]
uses_functions:
- assert_command_exists_bash_shell
- install_nbconvert_bash_infra
- notebook_to_pdf_bash_infra
uses_types: []
returns: []
returns_optional: false
error_type: "error_go_core"
imports: []
tested: false
tests: []
test_file_path: ""
file_path: "bash/functions/pipelines/export_analysis_pdfs.sh"
---
## Ejemplo
```bash
# Exportar todos los notebooks de un analisis
./export_analysis_pdfs.sh finanzas
# Con pattern especifico
./export_analysis_pdfs.sh ml "notebooks/01_*.ipynb"
# Via fn run
fn run export_analysis_pdfs finanzas
fn run export_analysis_pdfs ml "notebooks/01_*.ipynb"
```
## Flujo
1. `assert_command_exists uv` — verifica que uv esta disponible
2. `install_nbconvert` — instala nbconvert y playwright con chromium (idempotente)
3. `notebook_to_pdf` — convierte notebooks al patron indicado a PDF en `notebooks/pdf/`
## Notas
El analysis debe existir previamente en `analysis/{nombre}/` con un venv inicializado. Los PDFs se generan en `analysis/{nombre}/notebooks/pdf/` por defecto. El pipeline usa `set -euo pipefail` — cualquier fallo detiene la ejecucion.