python-packaging
Python package management with uv, poetry, PDM, and pyproject.toml. USE WHEN: "uv", "poetry", "pdm", "dependencies", "virtual environment", "pyproject.toml", "pip", "package management", "lockfile", "venv", "pip install", "requirements.txt", "pip freeze" DO NOT USE FOR: pip commands for running installed tools (use Bash) DO NOT USE FOR: conda/mamba environments - different ecosystem
What this skill does
# Python Packaging
> **Deep Knowledge**: Use `mcp__documentation__fetch_docs` with technology: `python` topic: `packaging` for complete documentation.
## Tool Comparison (2026)
| Tool | Speed | Lock Files | PEP 621 | Best For |
|------|-------|------------|---------|----------|
| **uv** | Fastest (10-100x pip) | Yes | Full | New projects, speed |
| Poetry | Good | Yes (strong) | Partial | Complex deps |
| PDM | Fast (can use uv) | Yes | Full | Standards compliance |
| pip | Baseline | No | N/A | Basic installation |
**Recommendation**: Use **uv** for new projects.
## uv Quick Start
```bash
# Install uv
curl -LsSf https://astral.sh/uv/install.sh | sh
# Windows: powershell -c "irm https://astral.sh/uv/install.ps1 | iex"
# Create project
uv init my-project
cd my-project
# Add dependencies
uv add fastapi pydantic
uv add --dev pytest ruff mypy
# Run commands
uv run python main.py
uv run pytest
# Sync dependencies from lock
uv sync
```
### uv Commands Cheatsheet
| Command | Description |
|---------|-------------|
| `uv init` | Create new project |
| `uv add <pkg>` | Add dependency |
| `uv add --dev <pkg>` | Add dev dependency |
| `uv remove <pkg>` | Remove dependency |
| `uv sync` | Install from lockfile |
| `uv lock` | Update lockfile |
| `uv run <cmd>` | Run in venv |
| `uv pip install` | pip-compatible install |
| `uv python install 3.12` | Install Python version |
| `uv tool install ruff` | Install global tool |
| `uvx ruff check .` | Run tool without install |
## pyproject.toml (PEP 621)
```toml
[project]
name = "my-project"
version = "1.0.0"
description = "Project description"
readme = "README.md"
license = {text = "MIT"}
requires-python = ">=3.10"
authors = [
{name = "Your Name", email = "[email protected]"}
]
dependencies = [
"fastapi>=0.115.0",
"pydantic>=2.0",
"sqlalchemy>=2.0",
]
[project.optional-dependencies]
dev = [
"pytest>=8.0",
"pytest-asyncio>=0.23",
"pytest-cov>=4.0",
"ruff>=0.14",
"mypy>=1.0",
]
[project.scripts]
my-cli = "my_project.cli:main"
[build-system]
requires = ["hatchling"]
build-backend = "hatchling.build"
[tool.uv]
dev-dependencies = [
"pytest>=8.0",
"ruff>=0.14",
]
```
## Virtual Environments
```bash
# uv (recommended)
uv venv
source .venv/bin/activate # Unix
.venv\Scripts\activate # Windows
# Standard library
python -m venv .venv
source .venv/bin/activate
# Check active environment
which python # Unix
where python # Windows
```
## Poetry (Alternative)
```bash
# Install
curl -sSL https://install.python-poetry.org | python3 -
# Create project
poetry new my-project
poetry init # In existing directory
# Add dependencies
poetry add fastapi
poetry add --group dev pytest
# Run commands
poetry run python main.py
poetry shell # Activate venv
# Install from lock
poetry install
```
### Poetry pyproject.toml
```toml
[tool.poetry]
name = "my-project"
version = "1.0.0"
description = ""
authors = ["Your Name <[email protected]>"]
[tool.poetry.dependencies]
python = "^3.10"
fastapi = "^0.115.0"
[tool.poetry.group.dev.dependencies]
pytest = "^8.0"
ruff = "^0.14"
[build-system]
requires = ["poetry-core"]
build-backend = "poetry.core.masonry.api"
```
## Dependency Versioning
```toml
# Exact version
"package==1.2.3"
# Minimum version (recommended for apps)
"package>=1.2.0"
# Compatible release (recommended for libraries)
"package>=1.2,<2.0"
"package~=1.2" # Same as >=1.2,<2.0
# Exclude versions
"package>=1.0,!=1.5.0"
```
## Lock Files
| Tool | Lock File | Purpose |
|------|-----------|---------|
| uv | `uv.lock` | Cross-platform, deterministic |
| Poetry | `poetry.lock` | Strong resolution |
| pip-tools | `requirements.lock` | Simple |
```bash
# Generate lock (uv)
uv lock
# Update all dependencies
uv lock --upgrade
# Update specific package
uv lock --upgrade-package fastapi
```
## Migration Guides
### From requirements.txt to uv
```bash
# In project with requirements.txt
uv init
uv add $(cat requirements.txt | grep -v "^#" | tr '\n' ' ')
rm requirements.txt
```
### From Poetry to uv
```bash
# Export from poetry
poetry export -f requirements.txt > requirements.txt
# Import to uv
uv init
uv add $(cat requirements.txt | cut -d'=' -f1 | tr '\n' ' ')
```
## Project Structure (src Layout)
```
my-project/
├── src/
│ └── my_package/
│ ├── __init__.py
│ ├── __main__.py
│ └── core.py
├── tests/
│ ├── __init__.py
│ └── test_core.py
├── pyproject.toml
├── uv.lock
└── README.md
```
**Benefits of src layout**:
- Tests run against installed package
- Prevents accidental imports from cwd
- Cleaner package distribution
## Anti-Patterns
| Anti-Pattern | Why It's Bad | Solution |
|--------------|--------------|----------|
| No lockfile | Non-reproducible builds | Always commit lockfile |
| `pip freeze > requirements.txt` | Includes transitive deps | Use proper tool (uv, poetry) |
| Global pip installs | Version conflicts | Always use virtual environments |
| Pinning to exact versions everywhere | Hard to update | Use ranges for libraries |
| Not separating dev dependencies | Bloated production | Use optional-dependencies or groups |
## Quick Troubleshooting
| Issue | Cause | Solution |
|-------|-------|----------|
| "No module found" | Not in venv | Activate venv or use `uv run` |
| Version conflicts | Incompatible deps | Check `uv pip compile --dry-run` |
| "Permission denied" | Global install attempt | Use virtual environment |
| Slow install | Using pip | Switch to uv |
| Lock file conflicts | Concurrent edits | Regenerate with `uv lock` |
Related in General
modeling-omnistudio-epc-catalog
IncludedSalesforce Industries CME EPC product-modeling skill for Product2-based catalog creation. Use when creating EPC products, configuring product attributes, building offer bundles with Product Child Items, or reviewing EPC DataPack JSON metadata for product catalog changes. TRIGGER when: user creates or updates Product2 EPC records, AttributeAssignment payloads, AttributeMetadata/AttributeDefaultValues, Offer bundles, or ProductChildItem relationships. DO NOT TRIGGER when: designing OmniScripts/FlexCards/Integration Procedures (use building-omnistudio-omniscript, building-omnistudio-flexcard, or building-omnistudio-integration-procedure), implementing Apex business logic (use generating-apex), or troubleshooting deployment pipelines (use deploying-metadata).
relationship-science-coach
IncludedUse this skill for direct, practical adult relationship coaching: couples conflict, repair, trust, marriage, dating, flirting, attachment patterns, emotional connection, sex, desire differences, eroticism, kink negotiation, affection, love languages, breakups, and long-term passion. Draw on Gottman, EFT and Hold Me Tight, attachment science, modern sex research, Perel, Nagoski, Kerner, Schnarch, Love and Stosny, and flexible love-language tools. Be concrete and low-hedge. Redirect only for imminent danger, abuse, coercive control, minors, non-consent, self-harm, stalking, or medical/legal/psychiatric decisions.
building-sf-integrations
IncludedSalesforce integration architecture and runtime plumbing with 120-point scoring. Use this skill to set up Named Credentials, External Credentials, External Services, REST/SOAP callout patterns, Platform Events, and Change Data Capture. TRIGGER when: user sets up Named Credentials, External Services, REST/SOAP callouts, Platform Events, CDC, or touches .namedCredential-meta.xml files. DO NOT TRIGGER when: Connected App/OAuth config (use configuring-connected-apps), Apex-only logic (use generating-apex), or data import/export (use handling-sf-data).
venue-templates
IncludedAccess comprehensive LaTeX templates, formatting requirements, and submission guidelines for major scientific publication venues (Nature, Science, PLOS, IEEE, ACM), academic conferences (NeurIPS, ICML, CVPR, CHI), research posters, and grant proposals (NSF, NIH, DOE, DARPA). This skill should be used when preparing manuscripts for journal submission, conference papers, research posters, or grant proposals and need venue-specific formatting requirements and templates.
let-fate-decide
IncludedDraws the 12 Houses of the Zodiac Tarot spread to inject entropy into planning when prompts are vague, ambiguous, or casually delegated. Interprets the spread to guide next steps. Use when the user says 'let fate decide', 'YOLO', 'whatever', 'idk', or other nonchalant phrases, makes Yu-Gi-Oh references, or when you are about to arbitrarily pick between multiple reasonable approaches. Prefer over ask-questions-if-underspecified when the user's tone is casual or playful rather than precision-seeking.
net-ops
IncludedCross-platform network troubleshooting (Windows, macOS, Linux) via local or remote shell. Use for: DNS broken, can't resolve hostnames, nslookup/dig works but apps fail, NRPT, WFP, scutil, /etc/resolver, systemd-resolved, /etc/resolv.conf, NetworkManager, VPN DNS leak residue (ProtonVPN/Mullvad/WireGuard/AnyConnect), AV/firewall blocking DNS or DoH, Tailscale DNS interaction, intermittent connectivity, remote diagnostics over SSH.