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
+37
View File
@@ -0,0 +1,37 @@
---
name: notebook_to_pdf
kind: function
lang: bash
domain: infra
version: "1.0.0"
purity: impure
signature: "notebook_to_pdf(project_dir: string, [pattern: string], [output_dir: string]) -> string"
description: "Convierte notebooks Jupyter a PDF usando nbconvert webpdf con chromium. Lista los PDFs generados al finalizar."
tags: [jupyter, notebook, pdf, export, nbconvert, playwright]
uses_functions: []
uses_types: []
returns: []
returns_optional: false
error_type: "error_go_core"
imports: []
tested: false
tests: []
test_file_path: ""
file_path: "bash/functions/infra/notebook_to_pdf.sh"
---
## Ejemplo
```bash
source notebook_to_pdf.sh
# Con defaults (notebooks/*.ipynb -> notebooks/pdf/)
notebook_to_pdf /home/lucas/analysis/finanzas
# Con pattern y output_dir custom
notebook_to_pdf /home/lucas/analysis/finanzas "notebooks/01_*.ipynb" "exports/pdf/"
```
## Notas
Requiere nbconvert y playwright con chromium instalados (usa `install_nbconvert` antes). Usa el venv del proyecto directamente (`.venv/bin/jupyter`). El output_dir es relativo a project_dir. Imprime los PDFs generados con sus rutas al finalizar. Falla si no se genera ningun PDF.