Stack Python - Statut Final Production
Date : 2026-01-26
Statut : ✅ Production Ready - Migration Complete
Dernière mise à jour : 2026-01-26
🎯 Migration Complète (2026-01-26)
Architecture 100% Python pour la Génération de Documents
La génération de documents est désormais entièrement gérée par les services Python. Les fallbacks Node.js ont été supprimés.
Changements Majeurs
- ✅ Plus de fallback Node.js : pdfkit, docx, xlsx-style supprimés
- ✅ Variable USE_PYTHON_PDF supprimée : Python toujours actif
- ✅ Queue simplifiée : EXPORTS_V2 → EXPORTS
- ✅ Code mort supprimé : GmailService, db.query(), markTokenAsUsed()
- ✅ Dépendances npm supprimées : pdfkit, docx, xlsx-style, @types/pdfkit
Services Migrés
- ✅ SessionRoadmapService : Word et PDF via Python
- ✅ QuotesController : Word export via PythonWordService
- ✅ InvoicesController : Word export via PythonWordService
- ✅ ContractTemplatesController : Word et Excel via Python
- ✅ DocxExportHelper : Conversation export via Python
- ✅ ExcelExportHelper : Conversation export via Python
- ✅ CreditNotesService : PDF via PythonPdfService
🎉 Résumé des Services
Services de Génération de Documents
| Service | Librairie | Endpoints |
|---|---|---|
| WeasyPrint | /api/pdf/* | |
| Word | python-docx | /api/word/* |
| Excel | openpyxl | /api/excel/* |
Services ML
| Service | Librairie | Endpoints |
|---|---|---|
| Embeddings | sentence-transformers | /api/embeddings/* |
| Intent Detection | transformers | /api/intent/* |
| Vector Search | qdrant-client | /api/qdrant/* |
📊 Architecture Complète
┌─────────────────┐
│ NestJS API │
│ (Backend) │
└────────┬────────┘
│
▼
┌─────────────────────────────────────────┐
│ Python Services │
│ │
│ ┌─────────────┐ ┌─────────────┐ │
│ │ PDF │ │ Word │ │
│ │ (WeasyPrint)│ │(python-docx)│ │
│ └─────────────┘ └─────────────┘ │
│ │
│ ┌─────────────┐ ┌─────────────┐ │
│ │ Excel │ │ Intent │ │
│ │ (openpyxl) │ │(transformers│ │
│ └─────────────┘ └─────────────┘ │
│ │
│ ┌─────────────┐ ┌─────────────┐ │
│ │ Embeddings │ │ Qdrant │ │
│ │(sent-trans) │ │ Client │ │
│ └─────────────┘ └─────────────┘ │
└─────────────────────────────────────────┘
│
▼
┌─────────────────┐
│ Qdrant │
│ (Vector DB) │
└─────────────────┘
📋 Configuration
Variables d'Environnement Backend
# Python Services URL
PYTHON_SERVICE_URL=http://python-services:8000
PYTHON_ML_SERVICE_URL=${PYTHON_SERVICE_URL} # Legacy alias
# Document Generation
USE_PYTHON_PDF=true
USE_PYTHON_WORD=true
USE_PYTHON_EXCEL=true
# Intent Detection
USE_PYTHON_INTENT=true
# OCR
USE_VISION_OCR=true
Variables d'Environnement Python
# Service
DEBUG=false
SERVICE_NAME=python-services
# Embeddings
EMBEDDING_MODEL=sentence-transformers/all-MiniLM-L6-v2
EMBEDDING_DEVICE=cpu
# Qdrant
QDRANT_HOST=qdrant
QDRANT_PORT=6333
# Redis
REDIS_HOST=redis
REDIS_PORT=6379
🚀 Déploiement
Build Docker
# Build
docker build -t python-services python-service/
# Ou via docker-compose
docker-compose -f infra/docker-compose.dev.yml up -d --build python-services
Vérification
# Health check
curl http://localhost:8000/health
# Liste des fonctionnalités
curl http://localhost:8000/
# Word health
curl http://localhost:8000/api/word/health
# Excel health
curl http://localhost:8000/api/excel/health
# PDF templates
curl http://localhost:8000/api/pdf/templates
📚 Documentation Associée
- PYTHON_STACK_EVOLUTION.md - Plan d'évolution
- PYTHON_STACK_IMPLEMENTATION.md - Implémentation détaillée
- PYTHON_STACK_DEPLOYMENT.md - Guide déploiement
✅ Statut des Fonctionnalités
| Fonctionnalité | Status | Notes |
|---|---|---|
| PDF Generation | ✅ | WeasyPrint |
| Word Generation | ✅ | python-docx |
| Excel Generation | ✅ | openpyxl |
| Intent Detection | ✅ | transformers |
| Embeddings | ✅ | sentence-transformers |
| Semantic Search | ✅ | Qdrant |
| OCR | ✅ | Vision APIs + Tesseract fallback |
Statut : ✅ Production Ready