Lokale Entwicklung
Potato für lokale Entwicklung und Tests einrichten.
Lokale Entwicklung
Bringen Sie Potato auf Ihrem lokalen Rechner für Entwicklung und Tests zum Laufen.
Voraussetzungen
- Python 3.7 oder höher
- pip-Paketmanager
- Git (optional, zum Klonen von Beispielen)
Installation
Mit pip (Empfohlen)
pip install potato-annotationAus dem Quellcode
git clone https://github.com/davidjurgens/potato.git
cd potato
pip install -e .Mit optionalen Abhängigkeiten
# For audio annotation support
pip install potato-annotation[audio]
# For all optional features
pip install potato-annotation[all]Schnellstart
1. Konfigurationsdatei erstellen
Erstellen Sie 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. Beispieldaten vorbereiten
Erstellen Sie data.json:
[
{"id": "1", "text": "I love this product!"},
{"id": "2", "text": "This is terrible."},
{"id": "3", "text": "It's okay, nothing special."}
]3. Server starten
potato start config.yaml4. Auf die Oberfläche zugreifen
Öffnen Sie Ihren Browser unter http://localhost:8000
Entwicklungsmodus
Hot Reloading
Auto-Neustart bei Konfigurationsänderungen aktivieren:
potato start config.yaml --reloadDebug-Modus
Detaillierte Protokollierung aktivieren:
potato start config.yaml --debugAusführliche Ausgabe
Alle Serveraktivitäten anzeigen:
potato start config.yaml --verboseVerzeichnisstruktur
Empfohlenes Projektlayout:
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
Konfiguration testen
Konfiguration validieren
Auf Syntaxfehler prüfen:
potato validate config.yamlVorschaumodus
Ohne Annotationen zu speichern starten:
potato start config.yaml --previewMit Beispieldaten testen
Testdaten generieren:
potato generate-data --count 10 --output test_data.jsonHäufige Probleme
Port bereits in Verwendung
# Use a different port
potato start config.yaml --port 8080
# Or in config.yaml
server:
port: 8080Datendatei nicht gefunden
Stellen Sie sicher, dass Pfade relativ zum Speicherort der Konfigurationsdatei sind:
# If data is in subdirectory
data_files:
- path: data/main.json
# Or use absolute path
data_files:
- path: /full/path/to/data.jsonZugriff verweigert
Dateiberechtigungen prüfen:
chmod 755 annotations/
chmod 644 data/*.jsonMehrere Benutzer lokal
Für das Testen von Mehrbenutzerszenarien:
allow_all_users: true
url_user_id_param: user_idMit verschiedenen Benutzern zugreifen:
http://localhost:8000/?user_id=annotator1http://localhost:8000/?user_id=annotator2
Annotationen zurücksetzen
Alle Annotationen löschen und neu beginnen:
# Remove annotation files
rm -rf annotations/*
# Restart server
potato start config.yamlUmgebungsvariablen
Über die Umgebung konfigurieren:
export POTATO_PORT=8000
export POTATO_DEBUG=true
export POTATO_DATA_PATH=/path/to/data
potato start config.yamlMit virtuellen Umgebungen verwenden
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-annotationIDE-Integration
VS Code
Installieren Sie die YAML-Erweiterung für die Unterstützung von Konfigurationsdateien:
// settings.json
{
"yaml.schemas": {
"https://potato-annotation.com/schema.json": "config.yaml"
}
}PyCharm
Führen Sie eine Ausführungskonfiguration ein:
- Hinzufügen → Python
- Skript:
potato - Parameter:
start config.yaml - Arbeitsverzeichnis: Ihr Projektpfad
Nächste Schritte
- Configuration Basics - Alle Konfigurationsoptionen erlernen
- Data Formats - Datenstruktur verstehen
- Production Setup - Für den echten Einsatz bereitstellen