ezmsg-org / ezmsg

Pure-Python DAG-based high-performance SHM-backed pub-sub and multi-processing pattern
https://ezmsg.readthedocs.io/en/latest/
MIT License
9 stars 4 forks source link

gen_to_unit: settings should use `signature` instead of `getfullargspec` #91

Closed cboulay closed 4 months ago

cboulay commented 5 months ago

I think it's the same issue as here: https://github.com/joblib/joblib/issues/1164

I'm guessing that the settings-reading code in gen_to_unit was written before the @consumer wrapper was written.

If you dive into getfullargspec, the first thing it does is call _signature_from_callable(func, follow_wrapper_chains=False, ...). If we could set that to follow_wrapper_chains=True then it would properly inspect the wrapped-function's arguments. But that is hard-coded.

In our case, this hasn't been too detrimental so far because we are still able to get the settings annotations using get_type_hints(func) but this doesn't know anything about default values.

griffinmilsap commented 5 months ago

Hmm. gen_to_unit is a bit of a beast -- @pperanich when you find time could you weigh in?

cboulay commented 4 months ago

I've already made some good progress and added some unit tests. I'll make a PR soon.