Install only the dev group (without base dependencies):
uv sync --only-group dev Install multiple groups at once:
uv sync --group dev --group prod Install all groups:
uv sync --all-groups
uv lock Purpose: Creates or updates the lock file (uv.lock)
uv lock # Lock all dependencies uv lock --upgrade # Update to latest compatible versions uv lock --upgrade-package django # Update only specific package
uv sync Purpose: Installs dependencies into your virtual environment
uv sync # Install base dependencies uv sync --group dev # Install base + dev dependencies uv sync --all-groups # Install all dependency groups
Key Difference:
uv lock = resolve dependencies (creates lock file) uv sync = install dependencies (uses lock file)
This separation allows for better control over when dependency resolution happens versus when installation occurs.
To update uv.lock to exclude dev dependencies, you have a few options:
Option 1: Lock without dev group (Recommended) uv lock --no-dev This will resolve and lock only the base dependencies and any production groups, excluding the dev group.
Option 2: Lock only specific groups uv lock --only-group prod This locks only the prod group dependencies (plus base dependencies).
Option 3: Lock base dependencies only uv lock --no-group dev This explicitly excludes the dev group from the lock resolution.
Alternative Approach - Multiple Lock Files: Some teams prefer maintaining separate lock files for different environments:
uv lock --no-dev --output-file uv.prod.lock
uv lock Then use them accordingly:
uv sync --frozen --lock-file uv.prod.lock
uv sync --group dev
After updating the lock file:
uv sync # This will now install only the dependencies in the updated lock file
The most common scenario is using uv lock --no-dev
when preparing for production deployment where you don't want development tools included.
To uninstall dev dependencies using uv, you have several approaches:
Option 1: Sync without dev group (Recommended) uv sync Since your pyproject.toml has default-groups = [], this will:
Install only base dependencies (Django) Automatically remove any packages not in the current sync (including dev dependencies) Option 2: Explicitly sync without dev group uv sync --no-group dev This explicitly excludes the dev group and removes any dev dependencies that were previously installed.
Option 3: Sync only production dependencies uv sync --group prod This will install base dependencies + prod group, and remove everything else (including dev dependencies).
Option 4: Remove specific packages manually uv remove ruff # Remove the specific dev dependency