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.1.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.1-py3-none-any.whl (9.6 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: pyprefab-0.3.1.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.1.tar.gz
Algorithm Hash digest
SHA256 359165b94ac9b0703017c2a223244d13c0f503cd37808efb13561a4708c333c7
MD5 222242406aa58dd566dd7fa17facda0e
BLAKE2b-256 67296fd6bf041428a96d9d7900d79bf1e620b1af1b5691c9006293f814e50749

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyprefab-0.3.1.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.1-py3-none-any.whl.

File metadata

  • Download URL: pyprefab-0.3.1-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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 90fde779648112f825b11616cf879f8167a59c590c4a1d2b9f1ed24b0132941d
MD5 d364bb45961f629fb7655c8cae3fd41d
BLAKE2b-256 6e2e6867d5acc984f14eecf885f760a9e8caeac10e335c5f1008b76b1ee1c0ff

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyprefab-0.3.1-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