Git Product home page Git Product logo

omniconf's Introduction

omniconf

Travis build status Coveralls License PyPI version Supported Python versions Supported Python implementations

A Python library that makes configuring your application independent from your configuration backend.

Documentation

Read the documentation on Read the Docs.

Design choices

Configuring applications is hard, and it doesn't help that there are many different (and valid) ways to do it:

  • cli arguments
  • config files: ConfigObj (.ini like), JSON, YAML
  • environment variables
  • key/value stores: etcd, consul (not yet implemented).

Each of this methods are a valid way to configure an application, and each have their own strengths. Cli arguments are most suited for tools and daemons. Configuration files are suited for applications that have more complex requirements. Environment variables and key/value stores are handy when using containers. You may even want to use a combination of methods (not yet implemented).

This library aims to make configuring the application easier, and allows you to use multiple configuration backends transparently.

To do this, configuration keys are defined as simple key / value pairs:

key=value

Sections and subsections are also supported, by using dot notated syntax:

section.subsection.key=value

To use a configuration key in your application, simply use:

from omniconf import config

variable = config("section.key")

omniconf needs to be told what keys to expect, define these as follows:

from omniconf import setting
# Simplest way to define a key
setting('key')

# A more complex example
setting('section.subsection.key', _type=dict, default={"foo": "bar"}, help="This is a very import key")

License

omniconf is licensed under LGPLv3. See the LICENSE file for details.

Contributing

To contribute, base your changes on the develop branch. Make sure your contribution doesn't break any existing tests, and add relevant new tests.

You can run the test suite using tox, which by default will run tests for all supported Python versions. You probably want to run just a few of them at a time, use the -e switch for that:

$ tox -e py27
$ tox -e py34

To check for style issues, run flake8:

$ tox -e flake8

When you're done, open a pull request on Github.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.