41 lines
1.7 KiB
Markdown
41 lines
1.7 KiB
Markdown
# JUPYTER HABILITADO EN ESTE ANALISIS
|
|
|
|
## Reglas OBLIGATORIAS para Claude
|
|
|
|
### 1. CODIGO INMUTABLE — NUNCA MODIFICAR CELDAS EXISTENTES
|
|
- **PROHIBIDO** usar NotebookEdit para reemplazar celdas existentes
|
|
- **SIEMPRE** anadir celdas NUEVAS al final del notebook
|
|
- Si hay un error en una celda, crear celda nueva con la correccion
|
|
- El historial de trabajo debe quedar intacto para trazabilidad
|
|
|
|
### 2. PROGRAMACION FUNCIONAL OBLIGATORIA
|
|
- **Funciones puras**: sin efectos secundarios, mismo input -> mismo output
|
|
- **Inmutabilidad**: nunca mutar datos, crear copias transformadas
|
|
- **Composicion**: funciones pequenas que se combinan
|
|
- Preferir: `map`, `filter`, `reduce`, list comprehensions
|
|
- Evitar: loops con mutacion, `global`, modificar argumentos in-place
|
|
|
|
### 3. SIEMPRE usar MCP jupyter para ejecutar codigo Python
|
|
- Las ejecuciones se ven en tiempo real en Jupyter Lab del usuario
|
|
- Compartimos variables y estado del kernel
|
|
- **NUNCA usar bash para ejecutar Python en este analisis**
|
|
|
|
### 4. Verificar Jupyter activo ANTES de ejecutar
|
|
- Si no esta activo: pedir al usuario que ejecute `./run-jupyter-lab.sh`
|
|
|
|
### 5. Gestion de notebooks
|
|
- Notebooks en la carpeta `notebooks/` o subcarpetas
|
|
- Si un notebook tiene >50 celdas, crear uno nuevo
|
|
- Nombrar descriptivamente: `01_exploracion.ipynb`, `02_limpieza.ipynb`
|
|
|
|
### 6. Gestion de Python
|
|
- **SIEMPRE usar `uv`** para gestionar dependencias
|
|
- Anadir paquetes con `uv add nombre_paquete`
|
|
|
|
### 7. Acceso al fn_registry
|
|
- `FN_REGISTRY_ROOT` apunta a la raiz del registry
|
|
- Para importar funciones Python: `sys.path.insert(0, os.path.join(os.environ["FN_REGISTRY_ROOT"], "python", "functions"))`
|
|
- Para consultar registry.db: `sqlite3` o `import sqlite3` con la ruta `$FN_REGISTRY_ROOT/registry.db`
|
|
|
|
|