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

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

iubeo-0.4.0-py3-none-any.whl (5.2 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: iubeo-0.4.0.tar.gz
  • Upload date:
  • Size: 4.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for iubeo-0.4.0.tar.gz
Algorithm Hash digest
SHA256 34220df840b705f8b87cfc79b2b1eece2437f52adc18b20856367df6f8eae56c
MD5 5a2d20a12ad4c6dfac53813bcc376dac
BLAKE2b-256 dfa62cc7ba067aeb0f7e66f3763c1c11ed0499cf949b54d4fa699c765fe3e4de

See more details on using hashes here.

File details

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

File metadata

  • Download URL: iubeo-0.4.0-py3-none-any.whl
  • Upload date:
  • Size: 5.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for iubeo-0.4.0-py3-none-any.whl
Algorithm Hash digest
SHA256 9ed50d9d3b80b89949666460a235babc6b2dac4b095530842bef37c2b79f17f4
MD5 569edc78b313ff65ae0f05ebfbed7132
BLAKE2b-256 078a6a36f52df4a4bb7478df15206fcfb1b5b095ca7b3cc03caa20fcd8040aa6

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page