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.2.tar.gz (4.2 kB view details)

Uploaded Source

Built Distribution

iubeo-0.2.2-py3-none-any.whl (5.3 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: iubeo-0.2.2.tar.gz
  • Upload date:
  • Size: 4.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.7

File hashes

Hashes for iubeo-0.2.2.tar.gz
Algorithm Hash digest
SHA256 3732ef84af84df60be86b5ed97d78c78925540d6df19f98ad3321d94e9e0c197
MD5 bbf9af640fb42e8a700da8c4a667483a
BLAKE2b-256 956aace4afdb4e100a90efb208163d529b505a4972164d9a62c79939dbf781cd

See more details on using hashes here.

File details

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

File metadata

  • Download URL: iubeo-0.2.2-py3-none-any.whl
  • Upload date:
  • Size: 5.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.7

File hashes

Hashes for iubeo-0.2.2-py3-none-any.whl
Algorithm Hash digest
SHA256 9e894cf43aaa231e2ba78dc50d6ebd534415f301764b8e1af6849b7dc75d9c64
MD5 47ef1c5d1fbcf021ee1aee38ccb953a5
BLAKE2b-256 f16a86029f195328f53b536808767ca9582f0dbc721448d1a7867f9ec86c64b9

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