Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

Groom

Groom, is an easy-to-use command-line application framework.

This module defines an even much easier way to make user-friendly command-line interfaces than any others else. Once you define a function as the entry point of your application, Groom will automatically detect how to parse sys.argv and apply it to your application. Groom also generates help and usage messages and issue errors when users set invalid arguments to your application.

introduction

Have you never wanted to create CLI tools with python more easily? Groom brings you an easier way to create CLI tools.

Here is an example:

import sys
from groom import positional, optional, Dispatcher

__version__ = '1.0'

def calculate(
    num1: positional(float, "former number", required=True, var_name='N1'),
    num2: positional(float, "latter number", required=True, var_name='N2'),
    operator: optional(str, "operator name", short_name='op')='add'):
  if operator == 'add':
    print(num1 + num2)
    return
  if operator == 'sub':
    print(num1 - num2)
    return
  if operator == 'mul':
    print(num1 * num2)
    return
  if operator == 'div':
    print(num1 / num2)
    return
  print("unknown operator:", operator, file=sys.stderr)

if __name__ == '__main__':
  Dispatcher(
    calculate,
    "calculate one of four arithmetic operations"
  ).dispatch()

…and then, you can call the program like this:

$ python calc.py 1 2 -op div

Once you call this program with -h or --help, Groom displays the help messages:

$ python calc.py -h
calc.py: 1.0

calculate one of four arithmetic operations

Usage:
  calc.py [-v | --version | -h | --help]
  calc.py <N1> <N2>
    [--operator <OPERATOR> | -op <OPERATOR>]

positional parameters:
N1:
  former number
  type: float
  required: True
N2:
  latter number
  type: float
  required: True

parameters:
--operator, -op:
  operator name
  type: str
  required: False
  multiple values: False
  default: add

Groom can handle 6 primitive types such as str, int, float, complex and bool and list of those types. If you specify another as a parameter type, Groom will throw TypeError.

Groom is licensed under the MIT License, for further details see LICENSE.txt.

Metadata

Release files for groom 0.1.0b1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for groom 0.1.0b1
File Size Uploaded Provenance Actions
groom-0.1.0b1.tar.gz 8.4 kB Without provenance Details for groom-0.1.0b1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for groom 0.1.0b1
File Interpreter ABI Platform Actions
groom-0.1.0b1-py3-none-any.whl Python 3 none any Details for groom-0.1.0b1-py3-none-any.whl

Total release size: 16.6 kB

Release files / groom-0.1.0b1.tar.gz

Download URL groom-0.1.0b1.tar.gz
Size 8.4 kB
Tags Source
SHA-256 checksum
How to use checksums
c5e688c00f75d7720a0431d92bbe30e9840b08f1cdaa871aa02d67857331be1c
BLAKE2b-256 checksum
How to use checksums
171257597aae6537c3288d82d623572c4999261314e328b7cbde3bc676119877
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.2.0 requests-toolbelt/0.8.0 tqdm/4.42.1 CPython/3.8.1

Release files / groom-0.1.0b1-py3-none-any.whl

Download URL groom-0.1.0b1-py3-none-any.whl
Size 8.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
48ec6a2b0618290509179565f9856c6faf54c592a3414b185d34e718d11f2b73
BLAKE2b-256 checksum
How to use checksums
4af0d727c8a987e9e05dd74021afcfdad7970bed0fb964fe85261538a98c47d7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.2.0 requests-toolbelt/0.8.0 tqdm/4.42.1 CPython/3.8.1

Security for groom 0.1.0b1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page