-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathconvert_to_notebooks_smart.py
More file actions
82 lines (69 loc) · 2.72 KB
/
Copy pathconvert_to_notebooks_smart.py
File metadata and controls
82 lines (69 loc) · 2.72 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
"""
CONVERSOR INTELIGENTE DE MARKDOWN A NOTEBOOKS (CONSEJO DE AGENTES) 🚀
===================================================================
Script de automatización que utiliza el NotebookCompilerAgent del consejo de agentes
para transformar las lecciones Markdown del repositorio en Jupyter Notebooks listos
para su uso por parte de los estudiantes.
"""
import shutil
import sys
from pathlib import Path
from src.multiagent_core.notebook_compiler_agent import NotebookCompilerAgent
if __name__ == "__main__":
if shutil.which("npx") is None:
print("ERROR: Node.js no está instalado o 'npx' no está en el PATH.")
print("Los diagramas Mermaid requieren Node.js para renderizarse como SVG.")
print(
"Instalar con: winget install OpenJS.NodeJS (Windows) o desde https://nodejs.org"
)
sys.exit(1)
BASE_DIR = Path(__file__).parent
SOURCE_DIR = BASE_DIR / "lecciones"
output_dir = BASE_DIR / "notebooks"
output_dir.mkdir(exist_ok=True)
files_to_convert = [
"UNIDAD_0_ENTORNO_Y_PRIMER_PROGRAMA.md",
"UNIDAD_1_PENSAMIENTO_COMPUTACIONAL_CLI.md",
"UNIDAD_2_METODOLOGIA_ALGORITMOS_PRUEBAS.md",
"UNIDAD_3_VARIABLES_OPERADORES.md",
"UNIDAD_4_ESTRUCTURAS_DECISION.md",
"UNIDAD_5_CICLOS_BUCLES_AGENTICOS.md",
"UNIDAD_6_MODULARIDAD_IA_MCP.md",
"UNIDAD_7_ESTRUCTURAS_DATOS_GRAFOS.md",
"UNIDAD_8_PROYECTO_INTEGRADOR.md",
"EXTRA_PYTHON_IA_NANOTECNOLOGIA_PARTE1_FUNDAMENTOS.md",
"EXTRA_PYTHON_IA_NANOTECNOLOGIA_PARTE2_DATOS_Y_ARCHIVOS.md",
"EXTRA_PYTHON_IA_NANOTECNOLOGIA_PARTE3_PAQUETES_Y_APIS.md",
]
print("=" * 75)
print("INICIANDO CONVERSOR MULTIAGENTE PEDAGÓGICO V3")
print("=" * 75)
print(f"Directorio Base: {BASE_DIR}")
print(f"Directorio de Salida: {output_dir}\n")
# Instanciar el agente compilador del consejo
compiler = NotebookCompilerAgent()
converted = 0
missing = []
for filename in files_to_convert:
filepath = SOURCE_DIR / filename
if not filepath.exists():
missing.append(filename)
continue
try:
compiler.compile(filepath, output_dir)
converted += 1
except Exception as e:
print(f" [ERROR] Error al compilar {filename}: {e}")
print("\n" + "=" * 75)
print("RESUMEN DE EJECUCION")
print("=" * 75)
print(f" [OK] Convertidos con exito: {converted}")
if missing:
print(
f" [PENDIENTE] Archivos Markdown no encontrados aun (pendientes de creacion): {len(missing)}"
)
for f in missing:
print(f" - {f}")
print("=" * 75)
if missing or converted < len(files_to_convert):
sys.exit(1)