This new implementation represents a substantial departure from the relatively thin wrapper around `git-config` that is used in legacy DataLad. It is based on the `Settings` class from `datasalad`, and extends it with additional features, for example a context manager to temporarily amend or override configuration items (see https://github.com/datalad/datalad/issues/5155). Unlike legacy DataLad, no global config manager instance is created on import. Instead, a `get_manager()` function is provided that can be called by any code that requires access to a global manager instance. A number of additional implementations of setting sources are provided, most notably individual sources for all of Git's configuration scopes. This now also includes a `git-worktree` scope, not supported by legacy DataLad. All sources use a dedicated `ConfigItem` class for individual settings. At present, this is identical to a `datasalad` `Setting`. However, this item class will be extended to support UI-based query for configuration values in the future. This is not implemented yet. A dedicated `ImplementationDefaults` source (singleton) is included in any `ConfigManager` instance. It can be populated with application specific defaults (on import). This commit also introduced type-coercion for few standard Git configuration items using this feature.
13 lines
351 B
Python
13 lines
351 B
Python
from __future__ import annotations
|
|
|
|
from datasalad.settings import Setting
|
|
|
|
|
|
class ConfigItem(Setting):
|
|
""" """
|
|
|
|
# at this point this class does nothing different
|
|
# than `Setting`. However, we foresee customization
|
|
# and we want to change the foundational type
|
|
# already now, such that we can have smoother upgrades
|
|
# later on
|