Python application template for personal use
Project description
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.tomlwith dependency groupsCHANGELOG.md,CONTRIBUTING.md,.gitignore, andREADME.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>
Details
pyprefab CLI
By design, pyprefab requires only a few pieces of information to create the boilerplate for a Python package.
โ pyprefab --help
Usage: pyprefab [OPTIONS] NAME
๐ Create Python package boilerplate ๐
โญโ Arguments โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฎ
โ * name TEXT Name of the project โ
โ [required] โ
โฐโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฏ
โญโ Options โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฎ
โ * --author TEXT Project author โ
โ [required] โ
โ * --description TEXT Project description โ
โ [required] โ
โ * --dir PATH Directory that will contain the project โ
โ [required] โ
โ --help Show this message and exit. โ
โฐโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฏ
For example:
pyprefab project_test --author lassie --description "this is a pet project for lassie" --dir ~/code/lassie
If you don't explicitly pass the --author, --description, and --dir options,
pyprefab will prompt you for them:
โ pyprefab project_test
Project author: lassie
Project description: this is a pet project for lassie
Project directory: /Users/dogs/code/lassie
Creating a dev environment for the new package
Follow the steps below to create a development environment for Python packages generated by pyprefab.
These directions use uv, but you can use your preferred tooling.
-
cdto the directory of the new Python package -
Create a virtual environment and install the project dependencies:
uv sync
-
Test the project setupt:
uv run <your_package_name>
You should see a log output stating that the project has been set up correctly.
For example:
2025-01-13 02:29:08 [info ] project_test successfully created.You can also run the tests:
uv run pytest
Optional:
-
Add the new project to a git repository:
git init git add . git commit -am "Initial commit"
-
If you use pre-commit, pyprefab's boilerplate includes a baseline
pre-commit-config.yamlconfiguration. To use it, make sure the project has been added to git (see above) and run the following command to install the pre-commit git hook scripts:pre-commit install
Contributing to pyprefab
Please refer to CONTRIBUTING.md.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pyprefab-0.4.0.tar.gz.
File metadata
- Download URL: pyprefab-0.4.0.tar.gz
- Upload date:
- Size: 53.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
990a2dc709613a490b1857b9d9f4a7e6c56c3076d14a023726d49f16e583d07a
|
|
| MD5 |
b0e87eeb3c668966e1c763e185353452
|
|
| BLAKE2b-256 |
5bb888e19becfcff1c25c919fb88c98b2c50a9955ca8ca16cffa5bdfc284d2f2
|
Provenance
The following attestation bundles were made for pyprefab-0.4.0.tar.gz:
Publisher:
publish-pypi.yaml on bsweger/pyprefab
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pyprefab-0.4.0.tar.gz -
Subject digest:
990a2dc709613a490b1857b9d9f4a7e6c56c3076d14a023726d49f16e583d07a - Sigstore transparency entry: 165754483
- Sigstore integration time:
-
Permalink:
bsweger/pyprefab@2ccc9bc55f10e3dc3ecb9a4abcca8112958967f4 -
Branch / Tag:
refs/tags/v0.4.0 - Owner: https://github.com/bsweger
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-pypi.yaml@2ccc9bc55f10e3dc3ecb9a4abcca8112958967f4 -
Trigger Event:
push
-
Statement type:
File details
Details for the file pyprefab-0.4.0-py3-none-any.whl.
File metadata
- Download URL: pyprefab-0.4.0-py3-none-any.whl
- Upload date:
- Size: 16.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
93b461a2d41bcd8c18a1becb096a0a80d544b32837d4998f665b2117c16421f4
|
|
| MD5 |
19bf58969086f9b168391a1d45853eaf
|
|
| BLAKE2b-256 |
09a21b155daa11c47ac815e27f2db809e125b81b19126c8cc16ffca2336ccda3
|
Provenance
The following attestation bundles were made for pyprefab-0.4.0-py3-none-any.whl:
Publisher:
publish-pypi.yaml on bsweger/pyprefab
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pyprefab-0.4.0-py3-none-any.whl -
Subject digest:
93b461a2d41bcd8c18a1becb096a0a80d544b32837d4998f665b2117c16421f4 - Sigstore transparency entry: 165754484
- Sigstore integration time:
-
Permalink:
bsweger/pyprefab@2ccc9bc55f10e3dc3ecb9a4abcca8112958967f4 -
Branch / Tag:
refs/tags/v0.4.0 - Owner: https://github.com/bsweger
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-pypi.yaml@2ccc9bc55f10e3dc3ecb9a4abcca8112958967f4 -
Trigger Event:
push
-
Statement type: