Skip to main content
Help improve PyPI by participating in a 5-minute user interface survey!

Simpler command line argument parsing

Project Description

Simpler command line argument parsing

In the spirit of `optimist <>`__: less magic, more flexibility.

pi install argv


Manual specification of arguments, no configuration:

import argv
argv.parse(['-i', 'input.txt', '-z', '--verbose'])
>>> {'i': 'input.txt', 'verbose': True, 'z': True}

Uses sys.argv (without the executable name) if no argument list is given:

import sys
>>> ['/usr/local/bin/bottler', 'exec', '', '--debug']
>>> {'_': ['exec', ''], 'debug': True}


parser = argv.Parser()
parser.add('-d', '--debug')
parser.parse(['exec', '', '--debug'])
>>> {'action': 'exec', 'd': True, 'debug': True, 'target': ''}


Continuous integration:

Travis CI Build Status

Or run tests locally:

python test



  • flag: a command line argument marked with a double dash or each component of a group denoted by a single dash. E.g.,
    • --verbose --logfile logs/app.txt has two flags: verbose and logfile.
    • -czf archive.tgz app/ has three flags: c, z, and f.
  • token: a white-space separated command line item. E.g.,
    • `–input= –logfile logs/app.txt


Copyright (c) 2013 Christopher Brown. MIT Licensed.

Release history Release notifications

This version
History Node


Download files

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

Filename, size & hash SHA256 hash help File type Python version Upload date
argv-0.0.3.tar.gz (6.8 kB) Copy SHA256 hash SHA256 Source None Nov 26, 2013

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging CloudAMQP CloudAMQP RabbitMQ AWS AWS Cloud computing Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page