datalad_core.config
Configuration management
This module provides the standard facilities for configuration management, query, and update. It is built on datasalad.settings.
The key piece is the ConfigManager that supports querying for
configuration settings across multiple sources. It also offers a context
manager to temporarily override particular configuration items.
With the method ConfigManager.for_dataset(), a manager instance tailored
to a specific dataset can be created. A “dataset” in this context is any
Git repository, with or without an initialized annex, and with or without
initialization as a DataLad dataset. Such an instance will share all sources
of the original manager instance, and supports additional sources for the
scopes of repository-local Git configuration, and branch-committed DataLad
configuration.
Usage
Basic usage is more or less identical to that of the datasalad.settings.
Importantly, and unlike the legacy DataLad approach, no instance of
ConfigManager is provided. Instead, if and when
such a common instance it needed, it must be obtained by calling
get_manager(). This is typically done first by a respective “entrypoint”
implementation. Subsequent calls will return the same instance.
The same pattern is applied to obtain a common instance of
ImplementationDefaults via get_defaults(). This instance
can be used to register defaults for any and all configuration settings
supported by a particular implementation. This can be done on importing
the respective modules.
|
|
|
Multi-source (scope) configuration manager |
Abstract base class for sources using git-config to read and write |
|
Source for Git's |
|
Source for Git's |
|
|
Source for Git's |
|
Source for configuration committed to a branch's |
|
Source for Git's |
Source for Git's environment variable based |
|
Source for registering implementation defaults of settings |
|
Placeholder type to indicate a value that has not been set |
|
Return a a process-unique ImplementationDefault instance |
|
Return a a process-unique, global ConfigManager instance |