Introducing begins — begins 0.8 documentation

begins 0.8 documentation
next | modules | index

# Introducing begins

Begins makes creating command line applications in Python easy.

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

> —Plato

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

    @begin.start(auto_convert=True)
    @begin.logging
    def run(host='127.0.0.1', port=8080, noop=False):
        if noop:
            return
        logging.info("%s:%d", host, port)

# Features

- 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.

# Table of Contents

- A short tutorial on begins
- Guide to using begins
- The begins API

# Issues

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