Claude Code oder Cursor für uv konfigurieren¶
Wie konfigurieren wir Claude Code oder Cursor, damit automatisch uv anstelle von pip für die Python-Paketverwaltung verwendet wird?
Claude Code verwendet CLAUDE.md-Dateien, um Speicher und Kontext
eures Projekts zu konfigurieren, wodurch eine einheitliche Tooling-Umgebung
für euren gesamten Entwicklungs-Workflow gewährleistet wird.
Vorausgesetzt, Claude Code und uv sind bereits auf eurem System installiert und ihr habt bereits ein uv-basiertes Python-Projekt z. B. erstellt mit uv init.
Tipp
Ihr könnt den /init-Befehl in Claude Code verwenden um euch
automatisch eine CLAUDE.md-Datei erstellen zu lassen und sie
anschließend mit uv-spezifischen Instruktionen zu ergänzen.
# Python environment with uv
Exclusively use uv for the Python environment in this project.
## Environment commands
- Use uv to install, sync, and lock Python dependencies
- Never use pip, pip-tools, poetry, or conda for dependency management
Use these commands:
- Install dependencies: `uv add <package>`
- Remove dependencies: `uv remove <package>`
- Sync dependencies: `uv sync`
## Running Python Code
- Run a Python script with `uv run <script-name>.py`
- Run Python tools like pytest with `uv run pytest`
Tipp
Denkt daran, eure projektspezifische CLAUDE.md-Datei mit Git zu verwalten, damit alle im Team, die mit Claude
Code arbeiten, automatisch die gleiche Konfiguration erhalten.
Siehe auch
Cursor Rules können verwendet werden, um uv anstelle von pip zu verwenden.
Vorausgesetzt, Cursor und uv sind bereits auf eurem System installiert und ihr habt bereits ein uv-basiertes Python-Projekt z. B. erstellt mit uv init.
Anschließend könnt ihr für eure Cursor Rules eine Cursor Markdown
Context-Datei uv.mdc in PROJECT/.cursor/rules/ erstellen
in mit
Name:
uvRule Type: Agent Requested
Description: Exclusively use uv for the Python environment in this project.
Anschließend könnt ihr folgende Regeln hinzufügen:
# Python environment with uv
Exclusively use uv for the Python environment in this project.
## Environment commands
- Use uv to install, sync, and lock Python dependencies
- Never use pip, pip-tools, poetry, or conda for dependency management
Use these commands:
- Install dependencies: `uv add <package>`
- Remove dependencies: `uv remove <package>`
- Sync dependencies: `uv sync`
## Running Python Code
- Run a Python script with `uv run <script-name>.py`
- Run Python tools like pytest with `uv run pytest`