Skip to content
/ python-boilerplate Public template

Minimal Python boilerplate using uv for fast dependency management, isolated virtual environments, and modern project structure.

License

Notifications You must be signed in to change notification settings

MrHDOLEK/python-boilerplate

Repository files navigation

Python boilerplate

uv logo

CodeQL GitHub CI GitHub license Python


A Python boilerplate using modern dev tools

Project setup

Development environment

# Clone the repository
git clone https://github.com/MrHDOLEK/python-boilerplate.git

# Navigate to project directory
cd python-boilerplate/

# Checkout working branch
git checkout <branch>

# Setup Python environment
uv python install
uv venv
source .venv/bin/activate

# Install dependencies
uv sync

# Install pre-commit hooks
pre-commit install

Tools & Features

uv

Fast Python package manager, written in Rust. Configuration in pyproject.toml and dependencies locked in uv.lock.

# Install a package
uv pip install <package>

# Run a command in the environment
uv run pytest tests

pre-commit

Framework for managing git hooks. Configuration in .pre-commit-config.yaml.

# Run against all files
pre-commit run --all-files

ruff

Fast Python linter and formatter. Rules defined in pyproject.toml.

# Format code
uv run ruff format .

# Check code
uv run ruff check .

Testing

Using pytest for tests:

# Run tests
uv run pytest tests

# Run tests with coverage
uv run pytest tests --cov=src

Docker

# Login to GitHub Container Registry
echo $GITHUB_TOKEN | docker login ghcr.io -u $GITHUB_USERNAME --password-stdin
# Build production image
docker buildx build -f .docker/python/Dockerfile -t my-python-application:latest .
# Run the application
docker run -it --rm my-python-application:latest

Documentation

Learn more at these links:

About

Minimal Python boilerplate using uv for fast dependency management, isolated virtual environments, and modern project structure.

Topics

Resources

License

Stars

Watchers

Forks

Contributors 2

  •  
  •