mymodule.py:
from aioworkers_attrs import attr
@attr.entity
class A:
c = attr.ib(type=int)
@c.default
def set_default_c(self):
return self.config.get('c', 0)
async def init(self):
x = self.c
# do something
conf.yaml:
a:
cls: mymodule.A
c: 1
run:
aioworkers -i -c conf.yaml
and type:
> from aioworkers_attrs import attr
> attr.asdict(context.a)
{'c': 1}