Skip to main content

The CLI helper you need 🥭

Project description


Currently in development.

Save time building command-line apps with LUPE


$ pip install lupe


  • Parses arguments
  • Converts flags snake_case for easier use
  • Negates flags when using the --no- prefix
  • Outputs version when -v, --version
  • Outputs description and supplied help text when -h, --help


On the command line:

$ python dinner --mango --no-banana

On the app:

import lupe

help = """
Usage foo [input]

  -h, --help      Show this help message and exit
  -v, --version   Show version and exit
  -m, --mangeo    Include a mango


  $ dinner --mango --no-banana

cli = lupe(help, {
    'flags': {
        'mango': {
            'type': 'boolen',
            'alias': 'm'
        'banana': {
            'type': 'boolen',

# {'mango': True, 'banana': False}

# [dinner]


lupe(help_message, options?)


Returns an object with:

  • inputs (Array) - Non-flag arguments
  • flags (Object) - Flags converted to snake_case excluding aliases
  • help (string) - The help text used with --help
  • show_help([exit_code=2]) (Function) - Show the help text and exit with exit_code
  • show_version() (Function) - Show the version text and exit


Type: string


Type: object

Shortcut for the help option.


Type: string

Version of the command-line application.


Type: object

Define argument flags.

The key is the flag name in snake_case and the value is an object with any of:

  • type: Type of value. (Possible values: string boolean number)
  • alias: Usually used to define a short flag alias.
  • default: Default value when the flag is not specified.
  • required: Determine if the flag is required. (Default: false)

Note that flags are always defined using a snake_case key (my_key), but will match arguments in kebab-case (--my-key).


flags = {
	'unicorn': {
		'type': 'string',
		'alias': 'u',
		'default': ['rainbow', 'cat'],
		'required': True,


Based on meow from @sindresorhus


MIT © Abraham Hernandez

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for lupe, version 0.1.12
Filename, size File type Python version Upload date Hashes
Filename, size lupe-0.1.12-py3-none-any.whl (3.4 kB) File type Wheel Python version py3 Upload date Hashes View
Filename, size lupe-0.1.12.tar.gz (3.2 kB) File type Source Python version None Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Huawei Huawei PSF Sponsor Microsoft Microsoft PSF Sponsor NVIDIA NVIDIA PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page