Skip to main content

Blueprints for configurations

Project description

bconfig (Blueprint Configuration)

Usage

import bconfig

bp = bconfig.Blueprint({
    'mykey': bconfig.Field(str, int),
    'subconf': {
        'foo': bconfig.Field(str, float)
    }
})

mc = bp.parse({
    'mykey': '123',
    'subconf': {
        'foo': '1.23'
    }
})

print(mc['mykey'] + 1) # 124
print(mc['subconf']['foo'] + 0.01) # 1.24

Usage with namespaces

import bconfig

@bconfig
class MyConf:
    mykey:int = bconfig.Field(str, int)

    @bconfig
    class subconf:
        foo:float = bconfig.Field(str, float)

mc = MyConf({
    'mykey': '123',
    'subconf': {
        'foo': '1.23'
    }
})

print(mc.mykey + 1) # 124
print(mc.subconf.foo + 0.01) # 1.24

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

bconfig-1.0.0.tar.gz (2.7 kB view hashes)

Uploaded Source

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