Skip to content

Geson-anko/python-uv-template

Repository files navigation

πŸš€ Python UV Template

GitHub stars License: MIT Python Version Format & Lint Test Type Check

English | ζ—₯本θͺž

✨ A modern Python project template using UV package manager for blazing fast dependency management

πŸ“‹ Features

  • 🐍 Python 3.12+ focused with type hints
  • πŸ§ͺ Pre-configured pytest with coverage
  • πŸ” Static type checking with pyright
  • 🧹 Code formatting with ruff
  • πŸ”„ CI/CD with GitHub Actions (separate workflows for pre-commit, tests, and type checking)
  • 🐳 Docker and Docker Compose support for development environment
  • πŸ“¦ UV package management for fast dependency resolution
  • πŸ“ Pre-commit hooks for code quality
  • πŸ—οΈ Project structure following best practices

πŸ› οΈ Quick Start

Create New Repository

Use this template

Clone and Setup

# Clone your new repository
git clone https://github.com/yourusername/your-new-repo.git
cd your-new-repo

# Run the interactive setup (Linux/macOS)
./setup.sh your-project-name

# Run the interactive setup (Windows)
.\Setup.ps1 your-project-name

# The setup script will:
# - Rename your project
# - Ask for your preferred language (English/Japanese)
# - Ask for your preferred build tool (Make/Just)
# - Clean up unnecessary files
# - Create a simple README template

# After setup, create virtual environment
make venv  # if you chose Make
# or
just venv  # if you chose Just

Development Tools

You can use either make or just commands:

Using Make

# Run all checks (format, test, type check)
make run

# Format code
make format

# Run tests
make test

# Run type check
make type

# Clean up temporary files
make clean

Using Just

# Show available commands
just

# Run all checks (format, test, type check)
just run

# Format code
just format

# Run tests
just test

# Run type check
just type

# Clean up temporary files
just clean

Docker Development

Using Make

# Build docker image
make docker-build

# Start development container
make docker-up

# Attach to development container
make docker-attach

# Stop containers
make docker-down

# Stop containers and remove volumes
make docker-down-volume

# Restart containers
make docker-restart

Using Just

# Build docker image
just docker-build

# Start development container
just docker-up

# Attach to development container
just docker-attach

# Stop containers
just docker-down

# Stop containers and remove volumes
just docker-down-volume

# Restart containers
just docker-restart

πŸ“‚ Project Structure

.
β”œβ”€β”€ .github/            # GitHub workflows and templates
β”‚   └── workflows/
β”‚       β”œβ”€β”€ pre-commit.yml    # Format & lint workflow
β”‚       β”œβ”€β”€ test.yml          # Test workflow
β”‚       └── type-check.yaml   # Type checking workflow
β”œβ”€β”€ .vscode/            # VSCode configuration
β”‚   └── extensions.json
β”œβ”€β”€ src/
β”‚   └── python_uv_template/  # Source code (will be renamed)
β”œβ”€β”€ tests/              # Test files
β”œβ”€β”€ .pre-commit-config.yaml
β”œβ”€β”€ docker-compose.yml  # Docker Compose configuration
β”œβ”€β”€ Dockerfile          # Docker image configuration
β”œβ”€β”€ Makefile            # Development commands
β”œβ”€β”€ pyproject.toml      # Project configuration
β”œβ”€β”€ LICENSE
└── README.md

πŸ„β€β™‚οΈ Using Docker Environment

This project includes Docker configuration for consistent development environment.

  1. Install Docker and Docker Compose
  2. Build and start the development container:
    make docker-build
    make docker-up
    make docker-attach
  3. The container includes all necessary tools and dependencies with proper shell completion

🧩 Dependencies

  • Python 3.12+
  • UV - Modern Python package manager
  • Development tools installed automatically via make venv or just venv
  • Optional: just - Command runner (alternative to make)

πŸ“„ License

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

🀝 Contributing

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

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add some amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

πŸ”§ Configuration

GitHub Actions

The project includes three separate workflows:

  • pre-commit.yml: Runs pre-commit hooks on all files
  • test.yml: Runs tests on multiple OS and Python versions (3.12, 3.13)
  • type-check.yaml: Runs pyright type checking

pyproject.toml

  • Configured for Python 3.12+
  • Uses UV for dependency management
  • Includes development dependencies for testing, linting, and type checking
  • Coverage configuration excludes test files

πŸ™ Acknowledgements

  • UV for the blazing fast package management
  • ruff for the powerful Python linter and formatter
  • pyright for static type checking
  • pre-commit for git hooks management

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published