Skip to main content

A modern Python project template using uv for package management

Project description

Python Project Boilerplate with UV

A modern Python project template using uv for package management and virtual environments, with comprehensive testing, documentation, and code quality tools pre-configured.

Prerequisites

System Requirements

  • Python 3.8 or higher
  • Git

Required Tools

  • uv - Fast Python package installer and resolver
  • pre-commit - Git hook manager

Installation & Setup

  1. Install uv

    curl -LsSf https://astral.sh/uv/install.sh | sh
    
  2. Clone and Navigate to Project

    git clone <your-repository-url>
    cd <project-directory>
    
  3. Create and Activate Virtual Environment

    uv venv
    source .venv/bin/activate  # On Unix/macOS
    # .venv\Scripts\activate    # On Windows
    
  4. Install Dependencies

    uv pip install -e .          # Install project in editable mode
    uv pip install pre-commit    # Install pre-commit
    pre-commit install           # Setup git hooks
    

Development Workflow

Code Style and Quality Tools

This project uses several tools to maintain code quality:

  • Black - Code formatting
  • Ruff - Fast Python linter
  • pre-commit hooks for:
    • YAML validation
    • Large file checks
    • Trailing whitespace removal
    • Debug statement checks

Pre-commit Configuration

The project includes pre-commit hooks for:

- Code formatting (black)
- Linting (ruff)
- YAML validation
- Documentation checks
- Test coverage verification
- Project tracking updates

To run all checks manually:

pre-commit run --all-files

Testing & Quality

Running Tests

pytest

Tests are automatically run with coverage reporting. The project requires:

  • Minimum 90% test coverage
  • Branch coverage enabled
  • Coverage reports in both terminal and XML formats

Coverage Reports

pytest --cov=src --cov-report=term-missing --cov-report=xml

Documentation

Generate API Documentation

uv pip install pdoc
pdoc -o docs/ src/

View Documentation

open docs/index.html

Documentation is automatically checked before commits using a custom pre-commit hook.

Project Structure

project/
├── bin/                # Scripts and executable files
├── docs/              # Generated documentation
├── hooks/             # Custom git hooks
│   ├── check_docs.py          # Documentation verification
│   └── update_project_tracker.py # Project tracking
├── src/               # Source code
│   └── main.py              # Main application code
├── tests/             # Test files
├── .gitignore        # Git ignore rules
├── .pre-commit-config.yaml # Pre-commit hook configuration
├── LICENSE           # Project license
├── pyproject.toml   # Project configuration and dependencies
├── README.md        # This file
└── ruff.toml       # Ruff linter configuration

Custom Hooks

Project Tracker

  • Automatically updates project metadata after commits
  • Requirements: PyYAML, jsonschema

Documentation Checker

  • Verifies documentation is up to date
  • Runs before commits
  • Requirements: pdoc

Contributing Guidelines

  1. Fork and Clone

    • Fork the repository
    • Clone your fork locally
  2. Setup Development Environment

    • Follow the installation steps above
    • Ensure all pre-commit hooks are installed
  3. Development Workflow

    • Create a new branch for your feature
    • Write tests for your changes
    • Ensure documentation is updated
    • Make your changes
    • Run tests and ensure coverage requirements are met
    • Commit your changes (pre-commit hooks will run automatically)
  4. Code Standards

    • Follow Black code style
    • Maintain test coverage above 90%
    • Update documentation for any new features
    • Ensure all pre-commit hooks pass
  5. Submit Pull Request

    • Push changes to your fork
    • Create a pull request with a clear description
    • Ensure all checks pass

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pyboplate-0.1.1.tar.gz (55.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pyboplate-0.1.1-py3-none-any.whl (3.7 kB view details)

Uploaded Python 3

File details

Details for the file pyboplate-0.1.1.tar.gz.

File metadata

  • Download URL: pyboplate-0.1.1.tar.gz
  • Upload date:
  • Size: 55.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for pyboplate-0.1.1.tar.gz
Algorithm Hash digest
SHA256 4b0c3bc100c6455cca3e3023e5d68550598bd521518c440514a8dcef2d3f71b6
MD5 a2e91e46a6219048a895e8cb357c29a0
BLAKE2b-256 669ea7b0678cf82fd90697fbea024d68785e0ebf378ec720908ab6fcedac2558

See more details on using hashes here.

File details

Details for the file pyboplate-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: pyboplate-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 3.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for pyboplate-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 208b572d66a4296cd04b78315ba3c4f5bea8f5f2042f8629418fad8ad5b0d726
MD5 98a0b0776eec1bf2acd9c8b1c7e544a5
BLAKE2b-256 488322f386aecde205d8c4cd15d5688cd12dba1afe7d33f056741ea435be9231

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page