xarray-contrib / xarray-simlab

Xarray extension and framework for computer model simulations
http://xarray-simlab.readthedocs.io
BSD 3-Clause "New" or "Revised" License
73 stars 9 forks source link

Fix _CountingAttr hack with attrs master #47

Closed benbovy closed 6 years ago

benbovy commented 6 years ago

A workaround before (hopefully) a cleaner solution (see https://github.com/python-attrs/attrs/issues/340).

Re-use argument list from attr.attrib for _CountingAttr.__init__(). It should at least reduce the risk of breaking the code when new arguments are introduced.

benbovy commented 6 years ago

Monkey patching _CountingAttr is probably better, after all (but still a hack). It adds the compute decorator for all attr.ib and not just for on_demand variables, but we could just ignore it when we don't need it.