Développement local
Installez et lancez Potato en local pour le développement et les tests. Couvre l'installation via pip, la configuration, le démarrage du serveur de développement et le diagnostic des problèmes de démarrage courants.
Faites tourner Potato sur votre machine pour développer et tester.
Prérequis
- Python 3.7 ou version supérieure
- Le gestionnaire de paquets pip
- Git (facultatif, pour cloner les exemples)
Installation
Avec pip (recommandé)
pip install potato-annotationDepuis les sources
git clone https://github.com/davidjurgens/potato.git
cd potato
pip install -e .Avec les dépendances facultatives
# For audio annotation support
pip install potato-annotation[audio]
# For all optional features
pip install potato-annotation[all]Démarrage rapide
1. Créer un fichier de configuration
Créez config.yaml :
task_name: "My First Annotation Task"
server:
port: 8000
data_files:
- path: data.json
text_field: text
annotation_schemes:
- annotation_type: radio
name: sentiment
description: "What is the sentiment?"
labels:
- Positive
- Negative
- Neutral
output:
path: annotations/2. Préparer des données d'exemple
Créez data.json :
[
{"id": "1", "text": "I love this product!"},
{"id": "2", "text": "This is terrible."},
{"id": "3", "text": "It's okay, nothing special."}
]3. Démarrer le serveur
potato start config.yaml4. Ouvrir l'interface
Rendez-vous sur http://localhost:8000 dans votre navigateur.
Mode développement
Rechargement à chaud
Redémarrage automatique quand la configuration change :
potato start config.yaml --reloadMode debug
Journalisation détaillée :
potato start config.yaml --debugSortie verbeuse
Voir toute l'activité du serveur :
potato start config.yaml --verboseArborescence
Organisation de projet recommandée :
my-annotation-project/
├── config.yaml # Main configuration
├── data/
│ ├── train.json # Training data
│ └── main.json # Annotation data
├── annotations/ # Output directory
├── templates/ # Custom HTML templates
└── static/ # Custom CSS/JS
Tester votre configuration
Valider la configuration
Repérer les erreurs de syntaxe :
potato validate config.yamlMode aperçu
Démarrer sans enregistrer les annotations :
potato start config.yaml --previewTester avec des données d'exemple
Générer des données de test :
potato generate-data --count 10 --output test_data.jsonProblèmes courants
Port déjà utilisé
# Use a different port
potato start config.yaml --port 8080
# Or in config.yaml
server:
port: 8080Fichier de données introuvable
Les chemins doivent être relatifs à l'emplacement du fichier de configuration :
# If data is in subdirectory
data_files:
- path: data/main.json
# Or use absolute path
data_files:
- path: /full/path/to/data.jsonPermission refusée
Vérifiez les permissions des fichiers :
chmod 755 annotations/
chmod 644 data/*.jsonPlusieurs utilisateurs en local
Pour tester des scénarios multi-utilisateurs :
allow_all_users: true
url_user_id_param: user_idConnectez-vous avec différents utilisateurs :
http://localhost:8000/?user_id=annotator1http://localhost:8000/?user_id=annotator2
Réinitialiser les annotations
Effacer toutes les annotations et repartir de zéro :
# Remove annotation files
rm -rf annotations/*
# Restart server
potato start config.yamlVariables d'environnement
Configuration par l'environnement :
export POTATO_PORT=8000
export POTATO_DEBUG=true
export POTATO_DATA_PATH=/path/to/data
potato start config.yamlUtilisation avec des environnements virtuels
venv
python -m venv potato-env
source potato-env/bin/activate # Linux/Mac
potato-env\Scripts\activate # Windows
pip install potato-annotationConda
conda create -n potato python=3.10
conda activate potato
pip install potato-annotationIntégration avec l'IDE
VS Code
Installez l'extension YAML pour la prise en charge du fichier de configuration :
// settings.json
{
"yaml.schemas": {
"https://potato-annotation.com/schema.json": "config.yaml"
}
}PyCharm
Créez une configuration d'exécution :
- Add → Python
- Script :
potato - Paramètres :
start config.yaml - Répertoire de travail : le chemin de votre projet
Étapes suivantes
- Bases de la configuration - Toutes les options de configuration
- Formats de données - Comprendre la structure des données
- Mise en production - Déployer pour un usage réel