262 lines
7.8 KiB
Markdown
Executable File
262 lines
7.8 KiB
Markdown
Executable File
# TODO - PriceWatch
|
|
|
|
Liste des tâches priorisées pour le développement de PriceWatch.
|
|
|
|
## Légende
|
|
- [ ] À faire
|
|
- [x] Terminé
|
|
- [~] En cours
|
|
|
|
---
|
|
|
|
## Phase 1 : Fondations CLI
|
|
|
|
### Étape 1 : Documentation et structure
|
|
- [x] Créer README.md complet
|
|
- [x] Créer TODO.md (ce fichier)
|
|
- [x] Créer CHANGELOG.md
|
|
- [x] Créer structure des dossiers du projet
|
|
- [x] Créer pyproject.toml avec dépendances
|
|
|
|
### Étape 2 : Modèle de données
|
|
- [x] Implémenter ProductSnapshot (Pydantic) dans core/schema.py
|
|
- [x] Champs métadonnées (source, url, fetched_at)
|
|
- [x] Champs produit (title, price, currency, shipping_cost, stock_status, reference, images, category, specs)
|
|
- [x] Champs debug (method, errors, notes, status)
|
|
- [x] Validation et serialization JSON
|
|
|
|
### Étape 3 : Core utilitaires
|
|
- [x] Implémenter core/logging.py
|
|
- [x] Configuration logger avec niveaux (DEBUG, INFO, ERROR)
|
|
- [x] Formatage des logs
|
|
- [x] Implémenter core/io.py
|
|
- [x] Lecture YAML (scrap_url.yaml)
|
|
- [x] Écriture JSON (scraped_store.json)
|
|
- [x] Validation des fichiers
|
|
|
|
### Étape 4 : Architecture des stores
|
|
- [x] Implémenter BaseStore abstrait (stores/base.py)
|
|
- [x] Méthode match(url) -> float
|
|
- [x] Méthode canonicalize(url) -> str
|
|
- [x] Méthode extract_reference(url) -> str
|
|
- [x] Méthode fetch(url, method, options) -> str
|
|
- [x] Méthode parse(html, url) -> ProductSnapshot
|
|
- [x] Implémenter Registry (core/registry.py)
|
|
- [x] Enregistrement dynamique des stores
|
|
- [x] Détection automatique du store depuis URL
|
|
- [x] Méthode get_best_store(url)
|
|
|
|
### Étape 5 : Scraping
|
|
- [x] Implémenter scraping/http_fetch.py
|
|
- [x] Fonction fetch_http(url, timeout, headers)
|
|
- [x] Gestion des erreurs (403, timeout, connexion)
|
|
- [x] User-Agent rotation
|
|
- [x] Logging détaillé
|
|
- [x] Implémenter scraping/pw_fetch.py
|
|
- [x] Fonction fetch_playwright(url, options)
|
|
- [x] Support headless/headful
|
|
- [x] Sauvegarde HTML optionnelle
|
|
- [x] Screenshot optionnel
|
|
- [x] Timeout configurable
|
|
- [x] Logging détaillé
|
|
|
|
### Étape 6 : Store Amazon
|
|
- [x] Créer structure stores/amazon/
|
|
- [x] Implémenter stores/amazon/store.py (AmazonStore)
|
|
- [x] match() : détection amazon.fr/amazon.com
|
|
- [x] canonicalize() : nettoyage URL vers /dp/{ASIN}
|
|
- [x] extract_reference() : extraction ASIN
|
|
- [x] parse() : parsing HTML vers ProductSnapshot
|
|
- [x] Créer stores/amazon/selectors.yml
|
|
- [x] Sélecteurs pour title
|
|
- [x] Sélecteurs pour price
|
|
- [x] Sélecteurs pour currency
|
|
- [x] Sélecteurs pour shipping_cost
|
|
- [x] Sélecteurs pour stock_status
|
|
- [x] Sélecteurs pour images
|
|
- [x] Sélecteurs pour category
|
|
- [x] Sélecteurs pour specs
|
|
- [ ] Ajouter fixtures HTML dans stores/amazon/fixtures/
|
|
|
|
### Étape 7 : Store Cdiscount
|
|
- [x] Créer structure stores/cdiscount/
|
|
- [x] Implémenter stores/cdiscount/store.py (CdiscountStore)
|
|
- [x] match() : détection cdiscount.com
|
|
- [x] canonicalize() : nettoyage URL
|
|
- [x] extract_reference() : extraction SKU
|
|
- [x] parse() : parsing HTML vers ProductSnapshot
|
|
- [x] Créer stores/cdiscount/selectors.yml
|
|
- [x] Sélecteurs pour tous les champs ProductSnapshot
|
|
- [ ] Ajouter fixtures HTML dans stores/cdiscount/fixtures/
|
|
|
|
### Étape 8 : CLI
|
|
- [x] Implémenter cli/main.py avec Typer
|
|
- [x] Commande `pricewatch run`
|
|
- [x] Commande `pricewatch detect`
|
|
- [x] Commande `pricewatch fetch`
|
|
- [x] Commande `pricewatch parse`
|
|
- [x] Commande `pricewatch doctor`
|
|
- [x] Flag --debug global
|
|
- [x] Logging vers console
|
|
|
|
### Étape 9 : Tests
|
|
- [x] Configurer pytest dans pyproject.toml
|
|
- [x] Tests core/schema.py (29 tests - 100% coverage)
|
|
- [x] Validation ProductSnapshot
|
|
- [x] Serialization JSON
|
|
- [x] Tests core/registry.py (40 tests - 100% coverage)
|
|
- [x] Enregistrement stores
|
|
- [x] Détection automatique
|
|
- [x] Tests d'intégration avec 4 stores réels
|
|
- [x] Tests core/io.py (36 tests - 97% coverage)
|
|
- [x] Lecture/écriture YAML/JSON
|
|
- [x] Sauvegarde debug HTML/screenshots
|
|
- [x] Tests stores/amazon/ (33 tests - 89% coverage)
|
|
- [x] match() avec différentes URLs
|
|
- [x] canonicalize()
|
|
- [x] extract_reference()
|
|
- [x] parse() sur fixtures HTML
|
|
- [x] Tests stores/cdiscount/ (30 tests - 72% coverage)
|
|
- [x] Tests complets avec fixtures réels
|
|
- [x] Tests stores/backmarket/ (25 tests - 85% coverage)
|
|
- [x] Tests complets avec fixtures réels
|
|
- [x] Tests stores/aliexpress/ (32 tests - 85% coverage)
|
|
- [x] Tests complets avec fixtures réels
|
|
- [x] Tests scraping/ (42 tests)
|
|
- [x] http_fetch avec mock (21 tests - 100% coverage)
|
|
- [x] pw_fetch avec mock (21 tests - 91% coverage)
|
|
|
|
### Étape 10 : Intégration et validation
|
|
- [x] Créer scrap_url.yaml exemple
|
|
- [x] Tester pipeline complet YAML → JSON
|
|
- [x] Tester avec vraies URLs Amazon
|
|
- [x] Tester avec vraies URLs Cdiscount
|
|
- [x] Vérifier tous les modes de debug
|
|
- [x] Valider sauvegarde HTML/screenshots
|
|
- [x] Documentation finale
|
|
|
|
### ✅ PHASE 1 TERMINÉE À 100%
|
|
**État final**: 295 tests passent / 295 tests totaux (100%)
|
|
**Coverage global**: 76%
|
|
|
|
**Détail par module**:
|
|
- ✅ core/schema.py: 100% coverage
|
|
- ✅ core/registry.py: 100% coverage (40 tests)
|
|
- ✅ core/io.py: 97% coverage (36 tests)
|
|
- ✅ scraping/http_fetch.py: 100% coverage (21 tests)
|
|
- ✅ scraping/pw_fetch.py: 91% coverage (21 tests)
|
|
- ✅ stores/amazon/: 89% coverage (33 tests)
|
|
- ✅ stores/aliexpress/: 85% coverage (32 tests)
|
|
- ✅ stores/backmarket/: 85% coverage (25 tests)
|
|
- ✅ stores/cdiscount/: 72% coverage (30 tests)
|
|
|
|
**4 stores opérationnels**: Amazon, Cdiscount, Backmarket, AliExpress
|
|
|
|
---
|
|
|
|
## Phase 2 : Base de données (Terminee)
|
|
|
|
### Persistence
|
|
- [x] Schéma PostgreSQL
|
|
- [x] Migrations Alembic
|
|
- [x] Models SQLAlchemy
|
|
- [x] Connexion DB (engine, session, init)
|
|
- [x] Tests DB de base
|
|
- [x] Repository pattern (ProductRepository)
|
|
- [x] ScrapingPipeline (persistence optionnelle)
|
|
- [x] CLI `--save-db/--no-db`
|
|
- [x] Tests end-to-end CLI + DB
|
|
- [x] Tests backward compatibility (`--no-db`)
|
|
- [x] Tests performance (100+ produits)
|
|
- [x] CRUD produits
|
|
- [x] Historique prix
|
|
|
|
### Documentation
|
|
- [x] Migration guide (JSON -> DB)
|
|
|
|
### Configuration
|
|
- [x] Fichier config (DB credentials)
|
|
- [x] Variables d'environnement
|
|
- [x] Docker Compose PostgreSQL/Redis
|
|
|
|
---
|
|
|
|
## Phase 3 : Worker et automation (En cours)
|
|
|
|
### Worker
|
|
- [x] Setup Redis
|
|
- [x] Worker RQ
|
|
- [x] Queue de scraping
|
|
- [x] Tests worker + scheduler
|
|
- [x] Gestion erreurs Redis (RedisUnavailableError)
|
|
- [ ] Retry policy
|
|
|
|
### Planification
|
|
- [x] Cron ou scheduler intégré
|
|
- [x] Scraping quotidien automatique
|
|
- [x] Logs des runs (JOB START/OK/FAILED)
|
|
- [x] Tests end-to-end worker + DB
|
|
- [x] Tests end-to-end CLI -> DB -> worker
|
|
|
|
## Phase 3 : API REST (En cours)
|
|
|
|
### API FastAPI
|
|
- [x] Endpoints read-only (products, prices, logs, health)
|
|
- [x] Auth token simple (Bearer)
|
|
- [x] Endpoints enqueue/schedule
|
|
- [x] CRUD products + prices + logs
|
|
- [x] Docker + uvicorn + config env
|
|
- [x] Tests API de base
|
|
- [x] Filtres avances (prix, dates, stock, status)
|
|
- [x] Exports CSV/JSON (products, prices, logs)
|
|
- [x] Webhooks (CRUD + test)
|
|
|
|
---
|
|
|
|
## Phase 4 : Web UI (Future)
|
|
|
|
### Backend API
|
|
- [x] FastAPI endpoints
|
|
- [x] Authentification
|
|
- [ ] CORS
|
|
|
|
### Frontend
|
|
- [x] Framework (Vue 3 + Vite)
|
|
- [x] Design responsive (layout dense + compact)
|
|
- [x] Dark theme Gruvbox (defaut) + Monokai
|
|
- [ ] Graphiques historique prix
|
|
- [ ] Gestion alertes
|
|
|
|
---
|
|
|
|
## Phase 5 : Alertes (Future)
|
|
|
|
### Notifications
|
|
- [ ] Système d'alertes (baisse prix, retour stock)
|
|
- [ ] Email
|
|
- [ ] Webhooks
|
|
- [ ] Push notifications
|
|
|
|
---
|
|
|
|
## Améliorations techniques
|
|
|
|
### Performance
|
|
- [ ] Cache Redis pour résultats
|
|
- [ ] Rate limiting par store
|
|
- [ ] Parallélisation scraping
|
|
|
|
### Robustesse
|
|
- [ ] Retry automatique sur échec
|
|
- [ ] Circuit breaker
|
|
- [ ] Monitoring (Prometheus?)
|
|
|
|
### Extensibilité
|
|
- [ ] Plugin system pour nouveaux stores
|
|
- [ ] Configuration stores externe
|
|
- [ ] API publique
|
|
|
|
---
|
|
|
|
**Dernière mise à jour**: 2026-01-15
|