Skip to main content

Friendlier way to write your config.

Project description

Build Status PyPI - License PyPI - Downloads

What is iubeo?

Friendlier way to write your config.

What is it good for?

You write how you want to read your config.

from iubeo import config

def list_from_string(val):
    return val.split(',')

CONFIG = config(
    {
        'DATABASE': {
            'USER': str,
            'PASSWORD': str,
            'HOST': str,
            'PORT': str,
        },
        'ALLOWED_HOSTS': list_from_string,
    },
    # prefix = '',  # default
    # sep = '__',  # default
)

with the above config, environment variables like

DATABASE__USER=example
DATABASE__PASSWORD=example-password
DATABASE__HOST=localhost
DATABASE__PORT=5432
ALLOWED_HOSTS=example.com,api.example.com,www.example.com

are read from the environment.

CONFIG.DATABASE.USER # "example-user"
CONFIG.DATABASE.PASSWORD # "example-password"
CONFIG.DATABASE.HOST # "localhost"
CONFIG.DATABASE.PORT # "5432"
CONFIG.ALLOWED_HOSTS # ["example.com", "api.example.com", "www.example.com"]

You can also change the separator and add a prefix to manage your environment variables better

CONFIG = config({
    'SECRETS': {
        'API_KEY': str,
    },
}, prefix='APP1', sep='-')

which would be read from

APP1-SECRETS-API_KEY=isik_kaplan_api_key

Iubeo also comes with a couple of pre-configured functions to read common environment variable types:

from iubeo import config, comma_separated_list, boolean

CONFIG = config({
    'DATABASE': {
        'USER': str,
        'PASSWORD': str,
        'HOST': str,
        'PORT': str,
    },
    'ALLOWED_HOSTS': comma_separated_list,
    'DEBUG': boolean,
})

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

iubeo-0.2.1.tar.gz (4.1 kB view details)

Uploaded Source

Built Distribution

iubeo-0.2.1-py3-none-any.whl (4.5 kB view details)

Uploaded Python 3

File details

Details for the file iubeo-0.2.1.tar.gz.

File metadata

  • Download URL: iubeo-0.2.1.tar.gz
  • Upload date:
  • Size: 4.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.13 CPython/3.9.16 Darwin/21.3.0

File hashes

Hashes for iubeo-0.2.1.tar.gz
Algorithm Hash digest
SHA256 e447348e24ad86304032d6c377f676048cd654f60599a05c010e681952e71ae2
MD5 dc76f52feb9f46ebe658c5696e272cdf
BLAKE2b-256 0b922177919156747ee5996ccb0a6269af738b4ebd3e762aff055789b44576b3

See more details on using hashes here.

File details

Details for the file iubeo-0.2.1-py3-none-any.whl.

File metadata

  • Download URL: iubeo-0.2.1-py3-none-any.whl
  • Upload date:
  • Size: 4.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.13 CPython/3.9.16 Darwin/21.3.0

File hashes

Hashes for iubeo-0.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 de6d022e52b0f3872ef42f28e8f4951bc5f4d628adfcffd57de85a2b2b745573
MD5 4c4045718b5affe6e9358155c3500bec
BLAKE2b-256 db3062d92369cba7632f794ee423b0ce76a94535671394fec31695f43951c4a8

See more details on using hashes here.

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