Skip to content

oceord/pylerplate

Repository files navigation

pylerplate

python uv ruff ty tox pre-commit make

A modern, minimal Python project boilerplate with batteries included

pylerplate eliminates the repetitive setup work when starting new Python projects. It comes pre-configured with modern development tools, sensible defaults, and a clean structure—giving you a solid foundation to build upon immediately.

Features

  • Modern Python tooling - uv, ruff, ty, tox, and pre-commit configured out-of-the-box
  • Git Hooks - Automated pre-commit checks to ensure code quality before every commit
  • Dependency management - Fast, reliable dependency resolution with uv
  • Code quality - Automatic formatting and comprehensive linting
  • Type checking - Static analysis with ty
  • Testing framework - Tox environments for isolated test runs
  • Standards compliant - Follows PEP standards and Python best practices
  • Makefile automation - Common tasks accessible via simple make commands
  • VSCode optimized - IDE settings included (works with any editor)
  • Minimal configuration - Essential settings only, ready for customization

Quick Start

Prerequisites

  • Python 3.12 or higher
  • uv (recommended) or pip
  • make (optional, but recommended)

Customization Checklist

Complete these steps to make the boilerplate your own:

1. Rename your package

# Rename the package directory
mv src/mypackage src/yourpackage

# Find and replace throughout the codebase
# Search for: mypackage
# Replace with: yourpackage

2. Update project metadata in pyproject.toml

[project]
name = "yourpackage"
version = "0.1.0"
description = "Your project description"
authors = [{ name = "Your Name", email = "your.email@example.com" }]
keywords = ["keyword1", "keyword2"]

3. Choose a license

Update the LICENSE file and copyright information:

  • Replace Copyright (c) 2023 oceord with your copyright notice
  • Choose an appropriate license for your project

4. Add dependencies

# Add runtime dependencies
uv add requests httpx

# Add development dependencies
uv add --dev pytest pytest-cov

# Or edit pyproject.toml directly

5. Clean up and customize

  • Search for TODO comments and address them
  • Review and update README.md (replace this file)
  • Adjust ruff and ty settings as needed

Setup

Clone the repository and set up your new project:

# Clone and prepare your project
git clone https://github.com/oceord/pylerplate.git myproject
cd myproject
rm -rf .git/

# Perform the Customization Checklist

# Initialize a new git repository
git init

# Set up the virtual environment and install git hooks
make dev

# Commit the initial state
git add .
git commit -m "Initial commit from pylerplate"

Development

Available Make Commands

make help              # Show all available commands
make format            # Format source code
make check             # Lint and static analysis
make test              # Run tests (via Tox)
make build             # Build distribution artifacts

Manual Commands

If you prefer not to use Make:

# Format code
uvx ruff format

# Lint code
uvx ruff check
uvx ty check

# Run tests
uvx --with tox-uv tox

# Build distribution
uv build

Project Structure

pylerplate/
├── src/
│   └── mypackage/          # Main package directory
│       └── __init__.py
├── tests/                  # Test directory
│   └── __init__.py
├── Makefile                # Task automation
├── pyproject.toml          # Project configuration
├── LICENSE                 # Project license
├── README.md               # This file
└── tox.toml                # Tox environments

Testing

This boilerplate uses Tox for testing, which creates isolated virtual environments for each environment:

# Run all environments
make test

# Or run specific environments
uvx --with tox-uv tox -e lint               # Run linting only
uvx --with tox-uv tox -e py312-typecheck    # Run type checking only

Tools Included

Tool Purpose Documentation
uv Fast Python package installer and resolver docs
ruff Extremely fast Python linter and formatter docs
ty Modern type checker for Python docs
tox Flexible test automation docs
pre-commit Framework for managing and maintaining multi-language pre-commit hooks docs
make Task automation and workflow management docs

Usage Scenarios

Use pylerplate if you:

  • Want modern development tools configured immediately
  • Need a quick Python environment for experimentation
  • Value clean, organized project structure
  • Follow engineering best practices and standards
  • Prefer minimal but sensible defaults

Look elsewhere if you:

  • Prefer older, more established tooling (setuptools, black, etc.)

Contributing

Contributions are welcome! Whether you've found a bug, have a feature suggestion, or want to improve the boilerplate:

  1. Open an issue to discuss your idea
  2. Fork the repository and create a feature branch
  3. Submit a pull request with your improvements

Please ensure your contributions align with pylerplate's philosophy: modern, minimal, and practical.

License

Distributed under the MIT License. See LICENSE for more information.

Acknowledgements

Support

If you encounter issues or have questions:


Happy coding!

About

A modern, minimal Python project boilerplate with batteries included

Topics

Resources

License

Stars

Watchers

Forks

Contributors