airflow

Convert to a mutable object

Use types.SimpleNamespace.

>>> from types import SimpleNamespace
>>> my_dict = {'name': 'foo', 'value': 1}
>>> obj = SimpleNamespace(**my_dict)
>>> obj.name
'foo'

Convert to an immutable object

Use collections.namedtuple.

>>> from collections import namedtuple
>>> my_dict = {'name': 'foo', 'value': 1}
>>> obj = namedtuple('Obj', my_dict.keys())(**my_dict)
>>> obj.name
'foo'