How to Add Dependencies¶
This guide shows you how to add runtime and development dependencies to a project generated from the template.
Prerequisites¶
- A generated project with uv installed
- Familiarity with Python packaging basics
Add a Runtime Dependency¶
Runtime dependencies are packages your users need when they install your package:
This updates pyproject.toml under [project.dependencies] and refreshes the lock file.
Add a Development Dependency¶
Development dependencies are organized into groups. Add to the appropriate group:
# Add to the tests group
uv add --group tests hypothesis
# Add to the docs group
uv add --group docs mkdocs-glightbox
# Add to the lint group
uv add --group lint bandit
After adding, sync your environment:
Dependency Groups¶
The template organizes development dependencies into these groups:
| Group | Purpose | Contents |
|---|---|---|
dev |
Meta-group - includes all others | References tests, lint, docs, fix, examples |
tests |
Testing tools | pytest, pytest-cov, pytest-mock, pytest-xdist, covdefaults, hypothesis |
lint |
Code quality | ruff, ty |
docs |
Documentation | mkdocs, mkdocs-material, mkdocstrings, pymdown-extensions |
fix |
Auto-formatting | pre-commit-uv |
examples |
Interactive notebooks | marimo (if include_examples=true) |
Add an Optional Dependency¶
For features users can opt into:
-
Edit
pyproject.tomlto define the optional group: -
Users install with:
Remove a Dependency¶
# Runtime dependency
uv remove requests
# Development dependency from a specific group
uv remove --group tests hypothesis
See Also¶
- Configuration Files -
pyproject.tomlstructure and tool settings - How to Customize Your Project - other project customizations