Skip to main content

An advanced parameter parser for Python.

Project description

Parameter Parser (Python)

Parameter Parser is a simple library used to parse intricate parameters from an array of strings.

Hint: This package is available through Python PIP. pip install parameterparser

Supports Python 2.7+

PyPI version PyCodeStyle Downloads GitHub issues PyPI - License

Documentation - Advanced Code Examples - Looking for the PHP version?


  • Parse command line parameters.
  • Assign aliases to parameters.
  • Custom closures for each command line parameter.
  • Variadic closure support for arguments taking more than one value.
  • Customize the way the command line is parsed.

Example Usage

import sys
from parameterparser import Parameter, Cluster, Parser

# Initialize a new Cluster
parameters = Cluster()

# Add a Parameter to the Cluster
parameter = Parameter("-", "name", lambda name: name)

         .set_description("Your name.")


# Create a new Parser using the Cluster
parser = Parser(sys.argv, parameters)

# Parse the parameters using the Parser.
results = parser.parse()

# Verify that the parameters were valid after parsing.
if not parser.is_valid():
    # Since it was not valid, output usage.
        "Parameter Parser",
        "An advanced parameter parser for Python",
    # Retrieve the name from the results
    name = results['name']

    # Output the name
    print("Your name is " + name + os.linesep)


~/ python -name 'Nathan Fiscaletti'

   Your name is Nathan Fiscaletti


Before commiting anything, please create a pre-commit hook with the following content.

This will ensure that the pycodestyle badge is properly updated.

python3 tests/

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

parameterparser-0.1.7.tar.gz (9.3 kB view hashes)

Uploaded source

Built Distribution

parameterparser-0.1.7-py3-none-any.whl (11.3 kB view hashes)

Uploaded py3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page