Design of lsst.pex.config¶
This page is a collection of notes describing the design of lsst.pex.config and the pex_config package in general.
Design goals¶
Enable configuration of plug-in algorithms provided at runtime.
Allow setting of one
Fieldto affect the values and the validation of others.Collocate the
Configdefinition with the code using theConfig.Provide a “Pythonic” interface.
Record the file and line of
Fieldinstance definitions and all changes toFieldinstances, including setting default values.Set defaults before overriding with user-specified values.
Support parameters with no (nonexistent) values, including overriding existing default values.
Enable closely-related
Configobjects to be represented efficiently, with a minimum of duplication.Have all user-modifiable
Configinstances be part of a hierarchical tree.Validate the contents of
Fieldinstances as soon as possible.Be able to “freeze” a
Configinstance to make it read-only.Be able to persist a
Configinstance to a file and restore it identically.Allow C++ control objects to be created from
Configobjects, with documentation and validation specified exactly once.Support lists of parameter values.
Architecture¶
Config uses a metaclass to record the Field attributes within each Config object in an internal dictionary.
The storage and history for the fields is also maintained in the Config object, not the Field instance itself.
This allows Field classes to be easily inherited.