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.1.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.1-py3-none-any.whl (5.2 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: iubeo-0.4.1.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.1.tar.gz
Algorithm Hash digest
SHA256 cb3418d2445d449a0a8afa50ecc642120b93794d7e65fbf3dc006053318a4986
MD5 5220c20dfecfbbf7f02b02514a33bdfb
BLAKE2b-256 dc5f60204f1d29120c3b61d73efa1dd39079975e37303c5389c373a0c08146b3

See more details on using hashes here.

File details

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

File metadata

  • Download URL: iubeo-0.4.1-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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 6a1e97eb6cdd96119f3fc867dc7aeaa507ece1d8d29dd3b20a8b9dce756325e2
MD5 11582dafa89aca31043047f8089339f0
BLAKE2b-256 780f7b9a392f67f3c657ab3707f89c64807693ad5a9037122ff0630db82abd8c

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