Skip to main content

Top-level package for optini.

Project description

https://img.shields.io/pypi/v/optini.svg https://img.shields.io/travis/datagazing/optini.svg Documentation Status

Python class to get options from command line and config file

Features

  • Get options from command line, config file, or defaults

  • Simple intuitive way to specify options

  • Provide reasonable logging defaults as an option (-v, -d, etc.)

  • Use conventions as defaults where possible

Examples

import optini
spec = {
    # boolean flag is the default type
    'someopt': {
        'help': 'set a flag',
    },
    'Another': {
        'help': 'this option takes a string arg',
        'type': str,
    },
}
# implies -s and --someopt command line options
# implies -A and --Another command line options
confobj = optini.Config(appname="myapp", spec=spec, file=True)
# defaults to ~/.myapp.ini as config file
if optini.opt.someopt:
    print("someopt flag is set")
print(optini.opt)

Credits

This package was created with Cookiecutter and the audreyr/cookiecutter-pypackage project template.

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

optini-0.1.0.tar.gz (13.6 kB view hashes)

Uploaded Source

Built Distribution

optini-0.1.0-py3-none-any.whl (6.6 kB view hashes)

Uploaded Python 3

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