ConfigSubset

class lsst.daf.butler.ConfigSubset(other: Config | str | ParseResult | ResourcePath | Path | Mapping[str, Any] | None = None, validate: bool = True, mergeDefaults: bool = True, searchPaths: Sequence[str | ParseResult | ResourcePath | Path] | None = None)

Bases: Config

Config representing a subset of a more general configuration.

Subclasses define their own component and when given a configuration that includes that component, the resulting configuration only includes the subset. For example, your config might contain dimensions if it’s part of a global config and that subset will be stored. If dimensions can not be found it is assumed that the entire contents of the configuration should be used.

Default values are read from the environment or supplied search paths using the default configuration file name specified in the subclass. This allows a configuration class to be instantiated without any additional arguments.

Additional validation can be specified to check for keys that are mandatory in the configuration.

Parameters:
otherConfig or ResourcePathExpression or dict

Argument specifying the configuration information as understood by Config.

validatebool, optional

If True required keys will be checked to ensure configuration consistency.

mergeDefaultsbool, optional

If True defaults will be read and the supplied config will be combined with the defaults, with the supplied values taking precedence.

searchPathslist or tuple, optional

Explicit additional paths to search for defaults. They should be supplied in priority order. These paths have higher priority than those read from the environment in ConfigSubset.defaultSearchPaths(). Paths can be str referring to the local file system or URIs, lsst.resources.ResourcePath.

Attributes Summary

component

Component to use from supplied config.

defaultConfigFile

Name of the file containing defaults for this config class.

requiredKeys

Keys that are required to be specified in the configuration.

Methods Summary

defaultSearchPaths()

Read environment to determine search paths to use.

validate()

Check that mandatory keys are present in this configuration.

Attributes Documentation

component: ClassVar[str | None] = None

Component to use from supplied config. Can be None. If specified the key is not required. Can be a full dot-separated path to a component.

defaultConfigFile: ClassVar[str | None] = None

Name of the file containing defaults for this config class.

requiredKeys: ClassVar[Sequence[str]] = ()

Keys that are required to be specified in the configuration.

Methods Documentation

classmethod defaultSearchPaths() list[lsst.resources._resourcePath.ResourcePath | str]

Read environment to determine search paths to use.

Global defaults, at lowest priority, are found in the config directory of the butler source tree. Additional defaults can be defined using the environment variable $DAF_BUTLER_CONFIG_PATHS which is a PATH-like variable where paths at the front of the list have priority over those later.

Returns:
pathslist

Returns a list of paths to search. The returned order is in priority with the highest priority paths first. The butler config configuration resources will not be included here but will always be searched last.

Notes

The environment variable is split on the standard : path separator. This currently makes it incompatible with usage of URIs.

validate() None

Check that mandatory keys are present in this configuration.

Ignored if requiredKeys is empty.