Config system which based on setuptools' entry points.
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.


Settei: Config system which bases on entry points of setuptools

The settei package is a library which gives you possibility to get config settings from entry points for specific application and environment. Generic purpose python settings library which uses entry points as a registry.

Introduces terms application and environment:

  • application is part of group's name in which you are storing entry points
  • environment is name of entry point


pip install settei


First of all you need to create entry points and put them into group, group comprises from two parts first of them is prefix settings_ and second one is name of your application, e.g. settings_backoffice or settings_frontoffice where backoffice or frontoffice is your application.

# in your
setup (
    # ...
    entry_points = {
        'settings_frontoffice': [
            'default =',
        'settings_backoffice': [
            'default =',
    # ...

The generate_config function should return instance of settei.config.Config class.

from settei.config import Config

def generate_config():
    config = Config()

    # adding some settings
    config['QUESTION'] = 'The Ultimate Question of Life, the Universe, and Everything'
    config['ANSWER'] = 41

    # or loading them from object

    # or from object

    return config

You can also do inheriting one settings by others but only inside group of entry points, e.g if you want to inherit default settings by local settings you just should mention name of entry point which you want to inherit

# in your file
def generate_config(default):

    # changing settings, the right answer is 42
    default['ANSWER'] = 42

    return default

And if in your code you will get local settings and check them

>> from settei import get_config
>> config = get_config('frontoffice', 'local')
>> print config['QUESTION']
The Ultimate Question of Life, the Universe, and Everything
>> print config['ANSWER']

Then you will need to install your package and after it with settei you will be able to get config settings for your application.

from settei import get_config

# get config settings for frontoffice application and local environment
config = get_config('frontoffice', 'local')

# get config settings for backoffice application and local environment
config = get_config('backoffice', 'local')

# now you can use it as you want
DEBUG = config['DEBUG']
# you can also get environment from CONFIG_ENVIRONMENT
# just run your script/application in this way
$ env CONFIG_ENVIRONMENT='dev' python
# and in script you can use get_config like
from settei import get_config

# get config settings for frontoffice application and dev environment because we have already specified environment
config = get_config('frontoffice')


If you have questions, bug reports, suggestions, etc. please create an issue on the GitHub project page.


This software is licensed under the MIT license


© 2013 Paylogic International.