pyprefab

A template-driven command line interface (CLI) that creates the scaffolding for a fully-functional, modern Python package. The goal of pyprefab is to get you straight to writing application code by handling project startup tasks like logging setup and creating a test harness.

The scaffolding includes:

  • project files in the src layout format

  • pyproject.toml with dependency groups

  • CHANGELOG.md, CONTRIBUTING.md, .gitignore, and README.md

  • automated package versioning with setuptools-scm

  • structlog-based pre-configured logging

  • a pytest-based test harness

  • a pre-commit configuration with common plugins like ruff for linting (optional)

  • GitHub workflow that automatically runs code checks, tests, and a test coverage report

  • GitHub workflows to publish the package to TestPyPI and PyPI

Quickstart

If you have uv installed, uv tool run is the fastest way to create a new Python package with pyprefab:

uvx pyprefab <name-of-new-package>

Otherwise, use pip or pipx to install pyprefab:

pip install pyprefab

pyprefab <name-of-new-package>