Skip to content
/ python-repo-template Public template

This is a template repository for quickly creating a python application that can be built, tested, and released as an internal python module.

License

Notifications You must be signed in to change notification settings

kyhau/python-repo-template

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

python-repo-template

CI Codecov CodeQL Snyk Checks Secrets Scan Python Version Code style: black GitHub last commit License

Modern Python project template with Poetry, Makefile workflows, automated testing, linting, and GitHub Actions CI/CD.

All notable changes to this project will be documented in CHANGELOG.

Supports Python 3.12, 3.13

✨ What's Included

πŸ”§ Development Tools

  • Poetry - Modern dependency management
  • Makefile - Convenient command shortcuts for common tasks
  • pytest - Testing framework with coverage reporting
  • black - Code formatting
  • flake8 - Python code linting
  • yamllint - YAML file linting

πŸ” Security & Code Quality

πŸš€ CI/CD

  • GitHub Actions - Automated testing and deployment
  • Codecov - Code coverage reporting
  • Stale Issue Management - Automatically closes inactive issues

πŸš€ Getting Started

1. Create Repository from Template

Click "Use this template" on GitHub or:

mkdir new_repo_name
cd new_repo_name
git init
git pull https://github.com/kyhau/python-repo-template

2. Customize Your Project

Update these files:

  • pyproject.toml - Package name, version, dependencies
  • Makefile - Set PACKAGE_NAME and TEST_PATH variables
  • README.md - Replace with your project description
  • app/ - Rename to your package name

3. Set Up Development Environment

Quick setup (recommended for first-time setup):

make setup-init

Manual setup (if you prefer step-by-step):

make setup-venv    # Configure Poetry to use local virtualenv
make install-all   # Install all dependencies

πŸ“‹ Development Workflow

Common Commands

make setup-init         # First-time setup (configure, lock, install everything)
make help               # Show all available commands
make install-all        # Install all dependencies (main, dev, test)
make test               # Run tests without coverage
make test-with-coverage # Run tests with coverage
make format-python      # Auto-format Python code
make lint-python        # Lint Python code
make lint-yaml          # Lint YAML files
make pre-commit         # Run all quality checks (format, lint, test)
make build              # Build the package
make clean              # Clean build artifacts

Running Tests

# Run tests with coverage
make test-with-coverage

# Run tests only
make test

# Format and lint code
make format-python
make lint-python
make lint-yaml

Managing Dependencies

# Update dependencies to latest compatible versions
make update-deps

# Regenerate lock file
make lock

πŸ—οΈ Project Structure

python-repo-template/
β”œβ”€β”€ .github/
β”‚   β”œβ”€β”€ workflows/        # CI/CD workflows
β”‚   └── dependabot.yml    # Dependency updates config
β”œβ”€β”€ app/                  # Your Python package
β”‚   β”œβ”€β”€ __init__.py
β”‚   └── main.py
β”œβ”€β”€ tests/                # Unit tests
β”‚   └── test_main.py
β”œβ”€β”€ pyproject.toml        # Project metadata and dependencies
β”œβ”€β”€ Makefile              # Build and test commands
└── README.md             # This file

πŸ“¦ Building and Releasing

# Build the package
make build

# The built package will be in dist/
ls dist/

About

This is a template repository for quickly creating a python application that can be built, tested, and released as an internal python module.

Topics

Resources

License

Code of conduct

Contributing

Security policy

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 6