Skip to main content

command line parsing speedster

Project description

Opster is a command line parser, intended to make writing command line applications easy and painless. It uses built-in Python types (lists, dictionaries, etc) to define options, which makes configuration clear and concise. Additionally it contains possibility to handle subcommands (i.e. hg commit or svn update).

Quick example

That’s an example of an option definition:

import sys
from opster import command

@command(usage='%name [-n] MESSAGE')
def main(message,
         nonewline=('n', False, 'don\'t print a newline')):
    'Simple echo program'
    if not nonewline:

if __name__ == '__main__':

Running this program will print the help: [-n] MESSAGE

Simple echo program


 -n --nonewline  don't print a newline
 -h --help       show help

I think this mostly describes what’s going on, except that I’d like to mention one interesting feature - if you are using long name for option, you can use only partial name, for example ./ --nonew a is valid command line. This is also true for subcommands: read about that and everything else you’d like to know in documentation.



  • Now it’s possible to call commands as regular function, where every non-supplied option will receive proper default (defined in option spec)
  • Globaloptions were simply dropped after parsing, fold them in regular options
  • Replace _ with - in command names, same as in options names
  • Respect empty strings as usage


Fixed bug with option names clashing with name of arguments for call_cmd.


Library renamed to opster.


  • Checks for option definition: long name should be specified always, short name should be 1 character in length if available.
  • More specific argument name in guessed usage (this happens if you have not specified usage for command).
  • Ability to add global decorator for all commands. See in repository for example: ui object, to handle verbose/quiet options.


Fixed bug, which prevented programs to work without arguments (displayed help instead) if they are not using subcommands.


  • Ability to hide subcommands from help listing.
  • Append program name to subcommand usage.


Minor fix for, to avoid troubles with installing when there is no docs in package.


Ability to call commands as regular functions, using arguments and keyword arguments.


Fixed problem with multiple help options in subcommands


Initial version

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 opster, version 0.9.9
Filename, size File type Python version Upload date Hashes
Filename, size opster-0.9.9.tar.gz (7.1 kB) File type Source Python version None Upload date Hashes View

Supported by

Pingdom Pingdom Monitoring Google Google Object Storage and Download Analytics Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page