https://github.com/kyhau/python-repo-template
This is a template repository for quickly creating a python application that can be built, tested, and released as an internal python module.
https://github.com/kyhau/python-repo-template
github-template hacktoberfest python
Last synced: 24 days ago
JSON representation
This is a template repository for quickly creating a python application that can be built, tested, and released as an internal python module.
- Host: GitHub
- URL: https://github.com/kyhau/python-repo-template
- Owner: kyhau
- License: mit
- Created: 2016-10-29T09:02:43.000Z (over 9 years ago)
- Default Branch: main
- Last Pushed: 2025-10-18T02:40:31.000Z (4 months ago)
- Last Synced: 2025-10-18T23:59:24.590Z (4 months ago)
- Topics: github-template, hacktoberfest, python
- Language: Makefile
- Homepage: https://kyhau.github.io/python-repo-template/
- Size: 554 KB
- Stars: 2
- Watchers: 0
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
- Codeowners: CODEOWNERS
Awesome Lists containing this project
README
# python-repo-template
[](https://github.com/kyhau/python-repo-template/actions/workflows/ci.yml)
[](https://codecov.io/gh/kyhau/python-repo-template)
[](https://github.com/kyhau/python-repo-template/actions/workflows/codeql-analysis.yml)
[](https://github.com/kyhau/python-repo-template/actions/workflows/snyk.yml)
[](https://github.com/kyhau/python-repo-template/actions/workflows/secrets-scan.yml)



[](http://en.wikipedia.org/wiki/MIT_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](./CHANGELOG.md).
**Supports Python 3.12, 3.13**
## ✨ What's Included
### 🔧 Development Tools
- **[Poetry](https://python-poetry.org/)** - Modern dependency management
- **[Makefile](Makefile)** - Convenient command shortcuts for common tasks
- **[pytest](https://pytest.org/)** - Testing framework with coverage reporting
- **[black](https://black.readthedocs.io/)** - Code formatting
- **[flake8](https://flake8.pycqa.org/)** - Python code linting
- **[yamllint](https://yamllint.readthedocs.io/)** - YAML file linting
### 🔐 Security & Code Quality
- **[CodeQL](https://codeql.github.com)** - Automated security analysis ([workflow](.github/workflows/codeql-analysis.yml))
- **[Secrets Scan](https://github.com/gitleaks/gitleaks)** - Gitleaks and TruffleHog for detecting hardcoded secrets ([workflow](.github/workflows/secrets-scan.yml))
- **[Snyk](https://snyk.io/)** - Vulnerability scanning ([workflow](.github/workflows/snyk.yml))
- **[Dependabot](https://docs.github.com/en/code-security/dependabot)** - Automated dependency updates ([config](.github/dependabot.yml))
### 🚀 CI/CD
- **[GitHub Actions](https://github.com/features/actions)** - Automated testing and deployment
- **[Codecov](https://codecov.io/)** - Code coverage reporting
- **Stale Issue Management** - Automatically closes inactive issues
## 🚀 Getting Started
### 1. Create Repository from Template
Click **"Use this template"** on GitHub or:
```bash
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):**
```bash
make setup-init
```
**Manual setup (if you prefer step-by-step):**
```bash
make setup-venv # Configure Poetry to use local virtualenv
make install-all # Install all dependencies
```
## 📋 Development Workflow
### Common Commands
```bash
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
```bash
# 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
```bash
# 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
```bash
# Build the package
make build
# The built package will be in dist/
ls dist/
```