From python-toolkit
Manages Python dependencies using UV (recommended), pip-tools, or requirements.txt. Guides tool selection, setup, conflict resolution, and workflows for new or existing projects.
How this skill is triggered — by the user, by Claude, or both
Slash command
/python-toolkit:dependency-managerThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
Manage Python project dependencies with UV, pip-tools, or requirements.txt.
Manage Python project dependencies with UV, pip-tools, or requirements.txt.
Choose UV for new projects (fast, modern), pip-tools for existing pip workflows, or requirements.txt for simple projects.
UV - Fast, modern Python package manager (recommended):
pip-tools - Lightweight, pip-compatible workflow:
requirements.txt - Simple, universal:
Install UV:
curl -LsSf https://astral.sh/uv/install.sh | sh
# Or with pip
pip install uv
Initialize new project:
uv init my-project
cd my-project
Add dependencies:
# Runtime dependency
uv add requests
# Development dependency
uv add --dev pytest
# With version constraint
uv add "requests>=2.28.0,<3.0.0"
Install dependencies:
uv sync
Update dependencies:
# Update all
uv lock --upgrade
# Update specific package
uv lock --upgrade-package requests
Remove dependencies:
uv remove requests
Show dependency tree:
uv tree
Export to requirements.txt:
uv pip compile pyproject.toml -o requirements.txt
Run commands in virtual environment:
uv run python script.py
uv run pytest
Install pip-tools:
pip install pip-tools
Create requirements.in:
# requirements.in
requests>=2.28.0
flask>=2.0.0
Create requirements-dev.in:
# requirements-dev.in
-c requirements.txt # Constrain to production versions
pytest>=7.0.0
black>=23.0.0
mypy>=1.0.0
Compile lock files:
# Compile production dependencies
pip-compile requirements.in
# Compile dev dependencies
pip-compile requirements-dev.in
This generates requirements.txt and requirements-dev.txt with pinned versions.
Install dependencies:
pip-sync requirements.txt requirements-dev.txt
Update dependencies:
# Update all
pip-compile --upgrade requirements.in
# Update specific package
pip-compile --upgrade-package requests requirements.in
Add new dependency:
pip-compile requirements.inpip-sync requirements.txtCreate requirements.txt:
pip freeze > requirements.txt
Install dependencies:
pip install -r requirements.txt
Separate dev dependencies:
Create requirements-dev.txt:
-r requirements.txt
pytest>=7.0.0
black>=23.0.0
Install with:
pip install -r requirements-dev.txt
UV/PEP 621 syntax (pyproject.toml):
[project]
dependencies = [
"requests>=2.28.0,<3.0.0", # Range
"flask~=2.0.0", # Compatible release
"django>=3.2,<4.0", # Range
"numpy==1.24.0", # Exact version
]
pip syntax (requirements.in or requirements.txt):
requests>=2.28.0,<3.0.0
flask~=2.0.0
django>=3.2,<4.0
numpy==1.24.0
pandas
Constraint operators:
==: Exact version>=, <=: Minimum/maximum version~=: Compatible release (patch updates),: Combine constraints (AND)UV/PEP 621 groups:
[project.optional-dependencies]
dev = ["pytest>=7.0.0", "black>=23.0.0"]
docs = ["sphinx>=5.0.0"]
test = ["coverage>=7.0.0"]
Install specific groups:
uv sync --extra dev
uv sync --extra docs
uv sync --all-extras
pip-tools approach:
Create separate .in files:
requirements.in - Productionrequirements-dev.in - Developmentrequirements-test.in - Testingrequirements-docs.in - DocumentationWith UV:
Check conflict:
uv add package-name
# UV will show conflict if it exists
Update constraints in pyproject.toml:
[project]
dependencies = [
"package-a>=2.0.0", # Relax constraint
"package-b>=3.0.0",
]
Force resolution:
uv lock
uv sync
With pip-tools:
Check conflict:
pip-compile requirements.in
# Will show resolution errors
Adjust constraints in requirements.in:
package-a>=2.0.0 # Relax constraint
package-b>=3.0.0
Recompile:
pip-compile requirements.in
Common conflict patterns:
Transitive dependency conflict: Two packages require incompatible versions of a third package
Python version conflict: Package requires newer Python than project supports
Platform-specific conflict: Package not available on current platform
UV/PEP 621:
[project]
dependencies = [
"pywin32>=305; sys_platform == 'win32'",
"python-daemon>=2.3; sys_platform == 'linux'",
]
pip:
pywin32>=305; sys_platform == 'win32'
python-daemon>=2.3; sys_platform == 'linux'
UV/PEP 621:
[project.optional-dependencies]
aws = ["boto3>=1.26.0"]
all = ["boto3>=1.26.0"] # Include all optional deps
Install with:
uv sync --extra aws
uv pip install package-name[aws]
UV (automatic):
# UV creates and manages venv automatically
uv sync
uv run python script.py
source .venv/bin/activate # Manual activation if needed
pip-tools (manual):
# Create venv
python -m venv venv
# Activate
source venv/bin/activate # Linux/Mac
venv\Scripts\activate # Windows
# Install
pip-sync requirements.txt
requirements.txt (manual):
python -m venv venv
source venv/bin/activate
pip install -r requirements.txt
UV in CI (recommended):
# .github/workflows/test.yml
- name: Install UV
run: curl -LsSf https://astral.sh/uv/install.sh | sh
- name: Install dependencies
run: uv sync
- name: Run tests
run: uv run pytest
pip-tools in CI:
- name: Install dependencies
run: |
pip install pip-tools
pip-sync requirements.txt requirements-dev.txt
- name: Run tests
run: pytest
requirements.txt in CI:
- name: Install dependencies
run: pip install -r requirements.txt
- name: Run tests
run: pytest
From requirements.txt to UV:
Initialize UV project:
uv init --no-readme
Import dependencies:
# Add each dependency from requirements.txt
cat requirements.txt | grep -v "^#" | xargs -I {} uv add {}
Separate dev dependencies:
uv add --dev pytest black mypy
Test:
uv sync
uv run pytest
From requirements.txt to pip-tools:
Rename requirements.txt:
mv requirements.txt requirements.in
Compile lock file:
pip-compile requirements.in
Create dev requirements:
echo "-c requirements.txt" > requirements-dev.in
echo "pytest" >> requirements-dev.in
pip-compile requirements-dev.in
Test:
pip-sync requirements.txt requirements-dev.txt
From pip-tools to UV:
Create pyproject.toml:
uv init --no-readme
Import from requirements.in:
cat requirements.in | grep -v "^#" | grep -v "^-" | xargs -I {} uv add {}
Test:
uv sync
UV workspace:
# Root pyproject.toml
[tool.uv.workspace]
members = ["packages/*"]
# packages/package1/pyproject.toml
[project]
name = "package1"
dependencies = ["requests>=2.28.0"]
# packages/package2/pyproject.toml
[project]
name = "package2"
dependencies = ["requests>=2.28.0"]
pip-tools approach:
# shared-requirements.in
requests>=2.28.0
# package1/requirements.in
-c ../shared-requirements.txt
flask>=2.0.0
# package2/requirements.in
-c ../shared-requirements.txt
django>=4.0.0
Commit lock files:
uv.lock - Always commitrequirements.txt (from pip-compile) - Always commitrequirements.txt (from pip freeze) - Consider committingUpdate regularly:
# UV
uv lock --upgrade
# pip-tools
pip-compile --upgrade requirements.in
Verify after updates:
# Run tests
uv run pytest
# Check for security issues
pip-audit
UV lock takes too long:
uv lock --offline to use cached packagespip-compile fails with conflict:
pip-compile --resolver=backtracking for better resolutionDependencies not found:
uv pip install --index-url https://custom-index.com packageVirtual environment issues:
rm -rf .venv && uv syncOutdated dependencies:
uv tree --outdated or pip list --outdateduv lock --upgrade --dry-run to preview changesnpx claudepluginhub p/armanzeroeight-python-toolkit-plugins-python-toolkitManages Python dependencies, virtual environments, and project workflows using the fast uv package manager. Use for setting up projects, resolving dependencies, and optimizing builds.
Manages Python projects with uv: initializes projects, adds/removes dependencies, handles lockfiles and syncing, configures pyproject.toml. Use for uv init, add, remove, lock, sync.
Manages Python dependencies, virtual environments, and project workflows using the uv package manager. Use when setting up Python projects, installing packages, or migrating from pip/poetry.