Blueprints for configurations
Project description
bconfig (Blueprint Configuration)
Typical usage
from bconfig import Blueprint, Field
bp = Blueprint({
'mykey': Field(str, int),
'subconf': {
'foo': 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 ns
from bconfig import ns, Field
@ns
class MyConf:
mykey:int = Field(str, int)
@ns
class subconf:
foo:float = 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-0.0.0.tar.gz
(2.5 kB
view hashes)