Skip to main content

CLI tooling to scaffold and manage Python Queued Message Handler projects

Project description

pyqmh-tools

Scaffolding and maintenance utilities for building a Python Queued Message Handler (QMH) project.

This repository is intended to be published as a PyPI package so the tooling can be installed with pip and used as project commands.

Installation

Install from PyPI (after publish):

pip install pyqmh-tools

Commands

This package provides three main commands:

  1. pyqmh_project_init
  2. pyqmh_module_add
  3. pyqmh_module_remove

Note: if you see pyqmg-module-remove elsewhere, treat that as a typo. The command name in this project is pyqmh_module_remove.


pyqmh_project_init

Initializes a new QMH project in the current directory.

What it does:

  • Creates src/ and src/modules/ if they do not already exist.
  • Creates src/modules/__init__.py if missing.
  • Copies template app.py into src/app.py if it does not already exist.
  • Prompts for app/project description (only when creating app.py).
  • Fills template placeholders such as description/author.
  • Creates root .gitignore from template if .gitignore does not exist.

Run from your target project directory:

pyqmh_project_init

pyqmh_module_add

Adds a new module to src/modules, or adds a new implementation to an existing factory module.

Behavior summary:

  • Prompts for module name first.
  • If module already exists and is a factory module, prompts to add a new implementation.
  • If module does not exist, prompts for module type:
    • standard
    • factory
    • repository

standard creation:

  • Creates src/modules/<module_name>/module.py from template.
  • Creates module __init__.py from template with imports/exports.
  • Updates src/modules/__init__.py import and __all__ (if file exists).
  • Updates src/app.py import and constructor registration (if file exists).

factory creation:

  • Creates factory.py, base.py, and simulated.py from templates.
  • Creates module __init__.py from template with imports/exports.
  • Includes factory/base/simulated exports.
  • Updates src/modules/__init__.py import and __all__ (if file exists).
  • Updates src/app.py import and constructor registration (if file exists).

repository creation:

  • Prompts for Git repository URL.
  • Adds the repository as a Git submodule under src/modules/<module_name>.
  • If repository URL is blank, falls back to template-based creation prompts.

Add new module:

pyqmh_module_add

pyqmh_module_remove

Removes an existing module from src/modules.

Behavior summary:

  • Prints available modules before prompting.
  • Accepts module name as folder name or CamelCase class name.
  • Shows files to be removed and asks for confirmation.
  • If module is a Git submodule:
    • deinitializes submodule
    • removes it from Git index
    • removes submodule metadata
  • If module is a regular folder:
    • removes the folder directly
  • Cleans up references after removal:
    • src/modules/__init__.py imports and __all__
    • src/app.py import and constructor registration

Remove module:

pyqmh_module_remove

Typical New Project Flow

From a new directory:

  1. Initialize project scaffold.
  2. Add one or more modules.
  3. Run app.

Example:

mkdir my-qmh-project
cd my-qmh-project

pyqmh_project_init
pyqmh_module_add
pyqmh_module_add

python src/app.py --debug

Development Notes

  • Commands are designed to be run from the project root where src/ should exist.
  • The tools are idempotent for common setup steps (existing files/folders are generally preserved).
  • Generated files are template-driven from src/pyqmh_tools/assets.

Navigation Customization with routes.json

Generated Flask app templates now support an optional routes.json file placed in the same directory as app.py.

Supported templates:

  • new-app-flask.py
  • new-module-app-flask.py

When routes.json is present and valid:

  • Navigation order follows the order of keys in the JSON file.
  • Top-level key/value pairs become direct navigation links.
  • A top-level modules object becomes a Modules dropdown.
  • This overrides the default behavior that auto-populates module links from discovered module folders.

When routes.json is missing or invalid:

  • Existing default behavior is used (auto-discovered modules and standard link layout).

Example:

{
  "Home": "/",
  "About": "/about",
  "modules": {
    "Hello World": "/module/hello_world"
  }
}

The example above renders navigation in this order:

  1. Home
  2. About
  3. Modules -> Hello World

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

pyqmh_tools-0.0.6.tar.gz (32.5 kB view details)

Uploaded Source

Built Distribution

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

pyqmh_tools-0.0.6-py3-none-any.whl (41.3 kB view details)

Uploaded Python 3

File details

Details for the file pyqmh_tools-0.0.6.tar.gz.

File metadata

  • Download URL: pyqmh_tools-0.0.6.tar.gz
  • Upload date:
  • Size: 32.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for pyqmh_tools-0.0.6.tar.gz
Algorithm Hash digest
SHA256 f69f6342caf364ad4f7fc7e4880dfecaf4235b6e98296d989a5c5547d99439ea
MD5 20004e775d4c0347a10d8ad98254b459
BLAKE2b-256 0df143c5f9a41c9a3f7baa6eb33bdc2511415f9f5e559cf7ad50e28c791cb6d3

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyqmh_tools-0.0.6.tar.gz:

Publisher: publish-to-pypi.yml on PCLabTools/pyqmh-tools

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

File details

Details for the file pyqmh_tools-0.0.6-py3-none-any.whl.

File metadata

  • Download URL: pyqmh_tools-0.0.6-py3-none-any.whl
  • Upload date:
  • Size: 41.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for pyqmh_tools-0.0.6-py3-none-any.whl
Algorithm Hash digest
SHA256 3fe74ed222a7243d151d263d4219af14b29ccec6ead7618b62a6e2e96d25faa5
MD5 1d7e06dd06e15a8d5bfa5123e2895146
BLAKE2b-256 44759644cff23be7a1a72efd2457422b1be1a80502e239cf13942d04bcd59e2f

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyqmh_tools-0.0.6-py3-none-any.whl:

Publisher: publish-to-pypi.yml on PCLabTools/pyqmh-tools

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