| name | dependency-update-helper |
| description | Manage Python dependencies using uv exclusively, add new packages, update existing dependencies, remove unused packages, and validate dependency compatibility. Use when adding packages, updating dependencies, resolving conflicts, or managing development dependencies. NEVER use pip directly. |
Dependency Update Helper
Manages Python dependencies exclusively through uv for the Maou project.
Core Rule
ONLY use uv. NEVER use pip directly.
All dependency management must go through uv to maintain consistency and avoid conflicts.
Adding Dependencies
Add Production Dependency
uv add package-name
uv add "package-name==1.2.3"
uv add "package-name>=1.2.0,<2.0.0"
uv add "package-name @ git+https://github.com/user/repo.git"
Add Development Dependency
uv add --dev package-name
uv add --dev pytest
uv add --dev mypy
uv add --dev ruff
Add Optional Dependency (Extras)
uv add --optional extra-group package-name
Updating Dependencies
Update Single Package
uv lock --upgrade-package package-name
uv sync
uv add "package-name>=2.0.0"
Update All Dependencies
uv lock --upgrade
uv sync
Update Lock File
uv lock
uv lock --check
Removing Dependencies
Remove Package
uv remove package-name
uv remove --dev package-name
Installing Dependencies
Install All Dependencies
uv sync
Install with Extras
uv sync --extra cpu --extra gcp
uv sync --extra cuda --extra aws
uv sync --extra tpu --extra gcp
Available extras:
- Hardware:
cpu, cuda, mpu, tpu
- Inference:
cpu-infer, onnx-gpu-infer, tensorrt-infer
- Cloud:
gcp, aws
Dependency Validation
Check Configuration
uv lock --check
uv tree
Show Package Information
uv pip list
uv pip show package-name
uv pip list --outdated
Compatibility Testing
After adding or updating dependencies, run QA pipeline:
uv add new-package
uv lock
uv sync
uv run ruff format src/
uv run ruff check src/ --fix
uv run isort src/
uv run mypy src/
uv run pytest
All steps must pass for dependency update to be valid.
Common Scenarios
Scenario 1: Add New Feature Dependency
uv add transformers
uv pip show transformers
uv run python -c "import transformers; print('✓')"
uv run pytest
Scenario 2: Update Security Vulnerability
uv pip list --outdated
uv lock --upgrade-package vulnerable-package
uv sync
uv pip show vulnerable-package
uv run pytest
Scenario 3: Add Type Stubs
uv add --dev types-requests
uv add --dev types-PyYAML
uv run mypy src/
Scenario 4: Remove Unused Dependency
grep -r "import package_name" src/
uv remove package-name
uv run pytest
Environment Management
Sync Environment
uv sync
uv run python --version
Dependency Conflict Resolution
Issue: Incompatible Version Constraints
uv tree
uv lock --upgrade
Issue: Platform-Specific Dependencies
Best Practices
1. Always Lock After Changes
uv lock
2. Commit Lock File
git add uv.lock pyproject.toml
git commit -m "feat(deps): add new-package"
3. Use Version Constraints
uv add "package-name>=1.2.0,<2.0.0"
uv add "package-name==1.2.3"
4. Document Extra Requirements
When adding optional dependencies, document in CLAUDE.md:
### New Extra: inference
```bash
uv sync --extra inference
Includes: onnx, tensorrt, optimization tools
### 5. Test Across Environments
```bash
# Test CPU environment
uv sync --extra cpu
uv run pytest
# Test CUDA environment
uv sync --extra cuda
uv run pytest
Pre-commit Hook Integration
After dependency updates, update pre-commit hooks:
uv run pre-commit autoupdate
uv run pre-commit run --all-files
Troubleshooting
Issue: "No module named X" After Install
grep "name = \"package-name\"" uv.lock
uv sync
uv run python -c "import sys; print(sys.path)"
Issue: Lock File Out of Date
uv lock
uv lock --upgrade
uv sync
References
- CLAUDE.md: Package management rules
- uv documentation: https://docs.astral.sh/uv/
pyproject.toml: Dependency configuration
uv.lock: Locked dependency versions