Skip to main content

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

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 details)

Uploaded Source

File details

Details for the file bconfig-1.0.1.tar.gz.

File metadata

  • Download URL: bconfig-1.0.1.tar.gz
  • Upload date:
  • Size: 2.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.4.2 requests/2.22.0 setuptools/45.2.0 requests-toolbelt/0.8.0 tqdm/4.30.0 CPython/3.8.10

File hashes

Hashes for bconfig-1.0.1.tar.gz
Algorithm Hash digest
SHA256 b9b568c21014aeaec789528ed57a7ed6d5141bcfb16da511f05d39f4d7113257
MD5 e37c935fe5b434182775233471d1c908
BLAKE2b-256 64b5ff2620f638de682b0566e7f95f833aa06c8980352538949b858d0f2aaf3f

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

1.0.1 This release

1 file

1.0.0

1 file

0.0.0

1 file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page