larq/zookeeper

Throw error if component has `__post_configure__` but is not configured

jneeven opened this issue · 3 comments

Feature motivation

It's currently possible to define a component with some crucial asserts in the __post_configure__, and then use it without configuring it, hence never triggering those asserts.

Feature description

It would be nice to check if a component has a custom __post_configure__, but I'm not sure where the best place to do that would be. It probably gets tricky quite quickly and may need to be done in e.g. __getattribute__.

It probably gets tricky quite quickly and may need to be done in e.g. __getattribute__.

I definitely agree with the motivation but I think doing this might be tricky, because in some scenarios we want __getattribute__ to work prior to configuration (e.g. in __pre_configure__) and I'm not sure how we'd tell the difference.

We definitely could do a check specifically for @tasks prior to calling the run method. Would that be useful do you think?

We definitely could do a check specifically for @tasks prior to calling the run method. Would that be useful do you think?

I ran into it with a component, so that probably only strengthens the incorrect assumptions that it'd get checked even without configuring it... I'll have a think about possible ways to do this