A modern, minimal Python project boilerplate using uv for fast, reliable dependency management.
- Fast Dependency Management: Uses uv - an extremely fast Python package installer and resolver
- Modern Python: Python 3.10+ with type hints support
- Code Quality Tools:
- Ruff - Lightning-fast Python linter and formatter
- Pyright - Static type checker
- pre-commit - Git hooks for code quality
- Testing: pytest with coverage support
- Makefile: Simple commands for common tasks
- Python 3.10 or higher
- uv installed
# macOS/Linux
curl -LsSf https://astral.sh/uv/install.sh | sh
# Windows
powershell -c "irm https://astral.sh/uv/install.ps1 | iex"
# Alternative: Using pip
pip install uv-
Clone or use this template:
git clone <your-repo-url> cd python-uv-boilerplate
-
Install dependencies:
make install # or manually: uv sync --all-groups uv run pre-commit install -
Run the application:
make run # or: uv run python main.py
.
├── main.py # Main application entry point
├── tests/ # Test directory
├── pyproject.toml # Project dependencies and configuration
├── uv.lock # Locked dependencies
├── Makefile # Common development tasks
├── .pre-commit-config.yaml # Pre-commit hooks configuration
└── README.md # This file
Run make help to see all available commands:
make help # Show all available commands
make install # Install dependencies and setup pre-commit hooks
make sync # Sync dependencies
make update # Update dependencies
make clean # Clean build artifacts and caches
make lint # Run linter (ruff)
make lint-fix # Run linter with auto-fix
make format # Format code with ruff
make format-check # Check code formatting
make type-check # Run type checker (pyright)
make test # Run tests
make test-cov # Run tests with coverage report
make ci # Run all CI checks
make run # Run main application# Add a runtime dependency
uv add <package-name>
# Add a development dependency
uv add --group dev <package-name>
# Add to a specific group
uv add --group test pytest-mock# Run all tests
make test
# Run tests with coverage
make test-cov
# Run specific test file
uv run pytest tests/test_example.py# Format code
make format
# Check formatting
make format-check
# Run linter
make lint
# Fix linting issues automatically
make lint-fix
# Run type checker
make type-check
# Run all CI checks
make ciPre-commit hooks automatically run on every commit to ensure code quality:
# Run pre-commit on all files
uv run pre-commit run --all-files
# Skip pre-commit hooks (not recommended)
git commit --no-verifyDependencies are managed in pyproject.toml:
dependencies: Runtime dependenciesdev: All development dependencies (includes lint, test, type-check groups)lint: Linting and formatting toolstest: Testing toolstype-check: Type checking tools
- Line length: 120 characters
- Python version: 3.10+
- Linter: Ruff with common sense defaults
- Formatter: Ruff
- Type checker: Pyright in basic mode
-
Update project metadata in
pyproject.toml:[project] name = "your-project-name" version = "0.1.0" description = "Your project description"
-
Add your code in
main.pyor create new modules -
Add tests in the
tests/directory -
Adjust configuration in
pyproject.tomlas needed
uv is a modern Python package installer and resolver that is:
- 10-100x faster than pip
- Drop-in replacement for pip, pip-tools, and virtualenv
- Reliable: Uses the same dependency resolution algorithm as pip
- Cross-platform: Works on macOS, Linux, and Windows
- Modern: Built in Rust for performance and safety
MIT License - see LICENSE file for details.
- Fork the repository
- Create a feature branch
- Make your changes
- Run
make cito ensure all checks pass - Submit a pull request