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,
})

It creates the environment variable names for you, and reads them from the environment, casting it to the final nodes.

Now your can just chain the attributes, and if it is the last node on the above dictionary, you get the environment variable casted to given callable.

DATABASE__USER=isik-kaplan
DATABASE__PASSWORD=isik-kaplan-db-password
DATABASE__HOST=localhost
DATABASE__PORT=5432
ALLOWED__HOSTS=isik-kaplan.com,api.isik-kaplan.com,www.isik-kaplan.com

are read from the environment, and are casted when you access the attribute.

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

Iubeo also comes with 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.0.tar.gz (3.9 kB view details)

Uploaded Source

Built Distribution

iubeo-0.2.0-py3-none-any.whl (4.4 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: iubeo-0.2.0.tar.gz
  • Upload date:
  • Size: 3.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.25.0 setuptools/51.0.0 requests-toolbelt/0.9.1 tqdm/4.54.1 CPython/3.7.1

File hashes

Hashes for iubeo-0.2.0.tar.gz
Algorithm Hash digest
SHA256 a42b98efc39024a8fa242ea0135fce9d31b62d4bcf92d2cef15f62b9b469cd4d
MD5 d4e5bbd68454ded1377e75849e4bdacd
BLAKE2b-256 b10019288785c467174f7a9ae5529f8527f138aca4cf8a7d0eec8b38278b82cb

See more details on using hashes here.

File details

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

File metadata

  • Download URL: iubeo-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 4.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.25.0 setuptools/51.0.0 requests-toolbelt/0.9.1 tqdm/4.54.1 CPython/3.7.1

File hashes

Hashes for iubeo-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 775894e99b770e69bd38805b0357459c2068fb865f5720326c61d79ad2af7219
MD5 ac91c3e241b51f4afa083be333f961af
BLAKE2b-256 6943fb3d273d7f94e99c10d743a82a64a169d896fb3f3fe65d0f08e703bec73f

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