Skip to main content

Python application template for personal use

Project description

pyprefab

Creates a new Python package from an opinioned set of templates.

Installing pyprefab

To install this package via pip:

pip install pyprefab

Generating boilerplate for a new Python package

Use pyprefab's command line interface to create a new Python package:

 pyprefab-create --help

 Usage: pyprefab-create [OPTIONS] NAME

 Generate a new Python project from templates.

╭─ Arguments ───────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
│ *    name      TEXT  Name of the project [default: None] [required]                                                           │
╰───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
╭─ Options ─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
│ *  --author                    TEXT  Project author [default: None] [required]                                                │
│    --description               TEXT  Project description                                                                      │
│    --directory                 PATH  Directory that will contain the project (defaults to current directory) [default: None]  │
│    --install-completion              Install completion for the current shell.                                                │
│    --show-completion                 Show completion for the current shell, to copy it or customize the installation.         │
│    --help                            Show this message and exit.                                                              │
╰───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯

For example:

pyprefab-create project_test --author lassie --description "this is a pet project for lassie" --directory ~/code/lassie

Setting up the package's dev environment

Follow the steps below to create a development environment for the package.

These directions use uv, but you can use your preferred tooling.

  1. cd to the directory of the new Python package

  2. Create a virtual environment seeded with pip:

    uv venv --seed
    
  3. Install dependencies + project as editable module

    uv sync
    
  4. 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
    

    Note: uv run runs commands in the virtual environment created by uv (see step 2). Alternately, you can activate the virtual environment the old-fashioned way and then run commands without the uv run prefix:

    source .venv/bin/activate
    <your package name>
    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.yaml configuration. 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
    

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

pyprefab-0.3.0.tar.gz (39.9 kB view details)

Uploaded Source

Built Distribution

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

pyprefab-0.3.0-py3-none-any.whl (9.6 kB view details)

Uploaded Python 3

File details

Details for the file pyprefab-0.3.0.tar.gz.

File metadata

  • Download URL: pyprefab-0.3.0.tar.gz
  • Upload date:
  • Size: 39.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.0.1 CPython/3.12.8

File hashes

Hashes for pyprefab-0.3.0.tar.gz
Algorithm Hash digest
SHA256 6231664b4ce31f103a3d01da8d0e4d1b6c75479ae0b0f0894028cc090d3c7622
MD5 00dfdf84de4d6968f656b43c4eba3e24
BLAKE2b-256 4422e22e8ca20312c5826bd72fbc34fe5f30d6416cac543800c92ab3906f978b

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyprefab-0.3.0.tar.gz:

Publisher: publish-pypi.yml on bsweger/pyprefab

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pyprefab-0.3.0-py3-none-any.whl.

File metadata

  • Download URL: pyprefab-0.3.0-py3-none-any.whl
  • Upload date:
  • Size: 9.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.0.1 CPython/3.12.8

File hashes

Hashes for pyprefab-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 47e33815c83dfb034570712e42532ad2014cd5ad4430033a10fb6c20cd4ffbf7
MD5 3954f3cc4561501698b08cd4cb27e993
BLAKE2b-256 006df35b0f19468b223737203319a49d8992036215d8888b66c083104f4174de

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyprefab-0.3.0-py3-none-any.whl:

Publisher: publish-pypi.yml on bsweger/pyprefab

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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