Skip to content

Latest commit

 

History

History
49 lines (27 loc) · 575 Bytes

README.rst

File metadata and controls

49 lines (27 loc) · 575 Bytes

aioworkers-attrs

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}