Fork me on GitHub

Introducing begins

Begins makes creating command line applications in Python easy.

“The beginning is the most important part of the work.”


Its decorator based API uses your function’s call signatures to generate command line parsers. Subcommands, type conversion, environment variables and configuration files are all supported. Extensions encapsulate common patterns for command line configuration like logging and tracebacks.

The following short example demonstrates many of begins features for both Python2 and Python3.

import begin
import logging

def run(host='', port=8080, noop=False):
    if noop:
        return"%s:%d", host, port)


  • Small API based on function decorators.
  • Generates command line options from function signatures.
  • Decorate multiple functions to create sub-commands.
  • Automatically convert command line arguments to expected types.
  • Use environment variables and command line files to set defaults.
  • Pre-packaged to extensions to simplify common tasks.


If you encounter problems, please refer to Issues from the guide.