A simple template to bootstrap Python packages with uv.
- uv-native — environment management, dependency resolution, and versioning in one tool.
- One config file —
pyproject.tomlhandles everything: dependencies, tools, versioning. - Ruff — single tool for linting and formatting (replaces black, isort, flake8).
- hatchling — lightweight, modern build backend.
-
Click "Use this template" and clone your new repository:
git clone https://github.com/your-username/your-repo.git cd your-repo -
Install uv if you haven't already:
curl -LsSf https://astral.sh/uv/install.sh | sh -
Run the initialization script and follow the prompts:
python init.py
-
Install all dependencies:
uv sync --all-groups
-
You're good to go. Run
make helpto see all available commands.
Note
init.pyis self-contained and will delete itself once completed. It is safe to delete and edit the files manually instead.
| Command | Description |
|---|---|
make sync |
Install all dependency groups |
make fmt |
Format and auto-fix code with ruff |
make lint |
Check style and lint (no changes) |
make test |
Run tests with coverage report |
make clean |
Remove build artifacts and cache files |
make release |
Bump version, tag, and push a new release |
To format and sort imports on save, add this to your settings.json:
{
"[python]": {
"diffEditor.ignoreTrimWhitespace": false,
"editor.wordBasedSuggestions": "off",
"editor.formatOnSave": true,
"editor.defaultFormatter": "charliermarsh.ruff",
"editor.codeActionsOnSave": {
"source.organizeImports": "explicit"
}
}
}