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
16 stars 6 forks source link

Pass Unit args and kwargs to SETTINGS if settings not provided explicitly #86

Closed cboulay closed 10 months ago

cboulay commented 10 months ago

Settings are typically passed to a Unit upon instantiation as follows (e.g.)

from ezmsg.sigproc.downsample import DownsampleSettings, Downsample

ds_unit = Downsample(DownsampleSettings(axis="time", factor=10))

With this change, we can alternatively pass the settings parameters directly to the Unit (without the __Settings class) and they will be used to initialize the settings. i.e.,

from ezmsg.sigproc.downsample import Downsample

ds_unit = Downsample(axis="time", factor=10)

It's just a little quality-of-life improvement that makes the entry-point scripts cleaner.

Fixes #71

cboulay commented 10 months ago

Is there a way for a child of ez.Settings to not be allowed to have a field named .settings?

griffinmilsap commented 10 months ago

I believe the settings metaclass can check for the existence of a field called settings. That's a warning at most though; I'll accept this for now, but let's make note of delivering a warning in the future.