Welcome to Bonfig’s documentation!¶
>>> from Bonfig import Bonfig, Store
>>> import json
>>> class Config(Bonfig):
... store = Store()
... pi = store.FloatField()
... def load(self):
... self.store = json.loads('{"pi": 3.14159}')
>>>
>>> conf = Config()
>>> conf.pi
3.14159
>>> conf.store
mappingproxy({'pi': 3.14159})
Stop writing your configurations as dictionaries and strange floating dataclasses, make them Bonfigs and make use of a whole bunch of great features:
- Declare your configurations as easy to read classes.
- Get all the power that comes with classes built into your configurations - polymorphism, custom methods and custom initialisation.
- Sleep safe in the knowledge your config won’t change unexpectedly.
- Ready made serialisation and deserialisation using out the box Fields - IntField, FloatField, BoolField, DatetimeField and PathField.
Sound good? Get started at Quickstart.