8000 GitHub - safurrier/python-collab-template: πŸ›  Python project template with unit tests, code coverage, linting, type checking, Makefile wrapper, and GitHub Actions.
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

πŸ›  Python project template with unit tests, code coverage, linting, type checking, Makefile wrapper, and GitHub Actions.

License

Notifications You must be signed in to change notification settings

safurrier/python-collab-template

Β 
Β 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

21 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Code Quality Checks codecov

Python Project Template

A modern Python project template with best practices for development and collaboration.

Features

  • πŸš€ Fast dependency management with uv
  • ✨ Code formatting with ruff
  • πŸ” Type checking with mypy
  • πŸ§ͺ Testing with pytest
  • 🐳 Docker support for development and deployment
  • πŸ‘· CI/CD with GitHub Actions

Python Version

This template requires Python 3.9 or higher and defaults to Python 3.12. To use a different version:

# List available Python versions
uv python list

# Use a specific version (e.g., 3.11)
make setup PYTHON_VERSION=3.11  # or UV_PYTHON_VERSION=3.11 make setup

# View installed Python versions
uv python list --installed

uv will automatically download and manage Python versions as needed.

Quickstart

# Clone this repo and change directory
git clone git@github.com:safurrier/python-collab-template.git my-project-name
cd my-project-name

# Initialize a new project
make init

# Follow the prompts to configure your project

This will:

  • Configure project metadata (name, description, author)
  • Handle example code (keep, simplify, or remove)
  • Initialize a fresh git repository
  • Set up development environment
  • Configure pre-commit hooks (optional, enabled by default)

Pre-commit hooks will automatically run these checks before each commit:

  • Type checking (mypy)
  • Linting (ruff)
  • Formatting (ruff)
  • Tests (pytest)

Alternatively, you can set up manually:

# Install dependencies and set up the environment
make setup

# Run the suite of tests and checks
make check

# Optional: Remove example code to start fresh
make clean-example

Development Commands

Quality Checks

make check      # Run all checks (test, mypy, lint, format)
make test       # Run tests with coverage
make mypy       # Run type checking
make lint       # Run linter
make format     # Run code formatter

Example Code

The repository includes a simple example showing:

  • Type hints
  • Dataclasses
  • Unit tests
  • Modern Python practices

To remove the example code and start fresh:

make clean-example

Docker Support

Development Environment

make dev-env    # Start a development container

This creates a container with:

  • All dependencies installed
  • Source code mounted (changes reflect immediately)
  • Development tools ready to use

Production Image

make build-image    # Build production image
make push-image     # Push to container registry

Project Structure

.
β”œβ”€β”€ src/                # Source code
β”œβ”€β”€ tests/             # Test files
β”œβ”€β”€ docker/            # Docker configuration
β”œβ”€β”€ .github/           # GitHub Actions workflows
β”œβ”€β”€ pyproject.toml     # Project configuration
└── Makefile          # Development commands

Contributing

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes
  4. Run make check to ensure all tests pass
  5. Submit a pull request

License

This project is licensed under the MIT License - see the LICENSE file for details.

About

πŸ›  Python project template with unit tests, code coverage, linting, type checking, Makefile wrapper, and GitHub Actions.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 66.5%
  • Makefile 29.6%
  • Dockerfile 3.9%
0