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 --help

 Usage: pyprefab [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.2.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.2-py3-none-any.whl (9.6 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: pyprefab-0.3.2.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.2.tar.gz
Algorithm Hash digest
SHA256 69cc65bd5f1c104d34b970aa7e1fb6f62f9b37d85ee0363441e848d79cfd250b
MD5 e5667565a5b2d306efc8920f48a0fed1
BLAKE2b-256 626afec9c05aa651f73fb88ff8190fe859e32fd5b9ddfad6eb35fe70ccf7e137

See more details on using hashes here.

Provenance

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

File metadata

  • Download URL: pyprefab-0.3.2-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.2-py3-none-any.whl
Algorithm Hash digest
SHA256 eb87a8884d6d5245f73b7f59ea0bcb4ec738f81bfaaf99149f805b80fac1cba7
MD5 8be4cd168b3c57f63bb27352e99630ed
BLAKE2b-256 0a1e303a9a8cbec7a5686b767b293ffb9a2e7e4f7af5b192f35eef787be8e5ab

See more details on using hashes here.

Provenance

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