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
Release history Release notifications | RSS feed
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.1.tar.gz
(2.8 kB
view hashes)