X Tutup
Skip to content

v-mdev/template-python-projects

Repository files navigation

Template Python Projects

A comprehensive template repository for Python projects, designed to provide a solid foundation for developing, testing, and deploying Python applications.

Features

  • Project Structure: Well-organized directory layout following Python best practices
  • Testing Framework: Pre-configured testing setup with pytest
  • Code Quality: Integrated linting and formatting with Ruff and Mypy via pre-commit
  • Virtual Environment: uv-based dependency management
  • CI/CD Ready: GitHub Actions configuration templates
  • Development Tools: Pre-commit hooks and development utilities

Quick Start

Prerequisites

  • Python 3.13 or higher
  • uv (for dependency management)

Installation

  1. Use the template:

Click the button Use this template -> Create a new repository

  1. Install dependencies:
uv sync
  1. Install pre-commit hooks:
uv run pre-commit install

Project Structure

template-python-projects/
├── src/                    # Source code (rename inner folder to your project name)
├── tests/                  # Test files
├── .github/                # GitHub workflows
├── pyproject.toml          # Project configuration (update with your project details)
├── .pre-commit-config.yaml # Pre-commit hooks (update hook versions)
├── README.md               # This file
└── .gitignore              # Git ignore rules

Development

Running Tests

uv run pytest

Linting & Formatting

uv run ruff check --fix .
uv run ruff format .

Type Checking

uv run mypy src/

Run all pre-commit hooks manually

uv run pre-commit run --all-files

After Cloning or Using as Template

Before starting development, make sure to apply the following changes:

  1. Rename the source folder: src/template-python-project/src/<your-project-name>/

  2. Update pyproject.toml:

    • Change name, version, description and other metadata fields
  3. Update pre-commit hook versions in .pre-commit-config.yaml to the latest available:

  4. Install pre-commit hooks:

uv run pre-commit install
  1. Configure GitHub Actions permissions: Go to your repository Settings → Actions → General → Workflow permissions and enable "Allow GitHub Actions to create and approve pull requests" if you want workflows to open PRs automatically.

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

License

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

About

Personal project template for quickly bootstrapping Python projects using uv, release-please and precommit

Topics

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages

X Tutup