Changelog
2.4.4
Fixed
Fixed a race condition on
LazyEval
2.4.3
Fixed
Fixed a bug where accessing a
EagerIOConfigurationProxyattribute after a previously suppressed load error caused an infinite wait instead of the exception replaying.
2.4.2
Refactored
Removed
type: ignore[misc], becausemypyfixed its issue.Explored some linting options.
2.4.1
Refactored
Refactored
LazyLoadConfiguration.__setstate__to useself.__dict__.update(state)to mimic documentation.Updating package to include Python 3.14 (and formally adding it to CI pipelines).
2.4.0
Changed
Made the core classes (
LazyEval,Configuration,LazyLoadConfiguration)pickle-able by running lazy logic just prior to pickling to remove the un-pickle-able locks.Changed from using
JSONPathOnlyWorksOnMappingsexception to newReferencingRootOnlyWorksOnMappingsexception, because scenario is not specific to JSON Path.ReferencingRootOnlyWorksOnMappingsinherits fromJSONPathOnlyWorksOnMappings, as to not break compatible, though to is a showstopping scenario.
Removed
Removed unused exceptions:
IniKeyExistAsANonMapping,IniTryToReplaceExistingKey,GetConfigReadBeforeSetExceptionExceptions were solely used by features removed in 2.0.0 releases.
Refactored
Refactored
as_dictto use dict comprehension.Refactored
_get_ref_string,json_default, andmergeto usematchforisinstancechecks for improve clarity andMatchNotExhaustivelinting.
2.3.1
Added
Added doc-strings to
Configuration.copyandMutableConfiguration.copymethods.Added parameters to
Configuration.__init__andMutableConfiguration.__init__documentationDuplicated overloads to improve
MutableConfigurationdocumentation.
Fixed
Baked-In Documentation: Corrected grammar in Project description and Readme.
EagerIOBinaryFile,EagerIOTextFile: Updated to excludedatafromreprandhash.Added Generic Type Parameters to
MutableConfigurationBoth default to
typing.Any, so no behavior change.Should have been updated alongside
Configuration.
KTis now bound tocollections.abc.HashableAllows type checking to catch what is a runtime error.
2.3.0
Added
Added
granular_configuration_language.yaml.file_opsmoduleRefactored from private modules.
Added EagerIO Feature Set
(internal detail) Added
SimpleFutureto wrapThreadPoolExecutorsetup and teardown.Added
granular_configuration_language.yaml.decorator.eageriomoduleAdded
LazyLoadConfiguration.eager_loadAdded
!EagerParseFileand!EagerOptionalParseFileTagsAdded Undocumented Tags:
!LoadBinaryand!EagerLoadBinaryTag to test binary EagerIO
Added
granular_configuration_language.yaml.decorators.with_tagdecoratorRewrote tag attribute tracking to add support.
G_CONFIG_ENABLE_TAG_TRACKERenvironment variable setting removed.
Added
TagHadUnsupportArgumentexception.Inherits from
ValueError, which was previously used.
Added Generic Type Parameters to
ConfigurationBoth default to
typing.Any, so no behavior change.
Changed
Changes to
available_plugins:Added
-l,--longoptionAdded
eager_iocolumnAdded shorten name option for
handler,needs_root_condition, andeager_io.Defaults as enabled.
-l,--longoption disables.
Changed internal Tag Function names to be shorter for
handlercolumn.Improved
--helpmessage.Help message uses
python -m granular_configuration_language.available_pluginsinstead ofavailable_plugins.py(Backported from 3.14)
Changes to
available_tags:Added
eio_inner_typecolumnImproved
--helpmessage.Help message uses
python -m granular_configuration_language.available_tagsinstead ofavailable_tags.py(Backported from 3.14)
A
ValueErrorraised during the type check ofTagDecoratorBasewill be converted into aTagHadUnsupportArgument.
Fixed
Made the function parameter for all decorators positional-only.
This is to enforce clearer usage in the unexpected case of not using
@.
Changed
Configuration.gettype signature to match Python 3.12Mapping.getsignature.i.e.
keyis positional-only. (Runtime does not enforce.)
Minor correctness issues caught by Ruff that still past their tests before and after.
2.2.3
Fixed
Boolean expression for the
without_refinterpolations missing parentheses.!OptionalParseFileis documented to returnNone. It was returning empty mapping. Changed to result to match documentation.
2.2.2
Added
Added
needs_root_conditioncolumn toavailable_plugins.G_CONFIG_ENABLE_TAG_TRACKERto Environment Variables.
Changed
Made tag attribute tracking optional via
G_CONFIG_ENABLE_TAG_TRACKER.available_pluginsandavailable_tagssetG_CONFIG_ENABLE_TAG_TRACKERtemporarily.
!Maskedis now lazy, for consistency withinterpolate_value_without_refrecommendations.Improved documentation.
2.2.1
Changed
SafeConfigurationProxyis now registered as a subclass ofConfiguration.Updated many doc-strings to improve generated documentation.
2.2.0
Added
python -m granular_configuration_language.available_tagsis publicly usable nowpython -m granular_configuration_language.available_plugins
Changed
Refactored
load_fileandmake_chain_messageto make testing easier
2.1.0
Changed
!ParseFile,!OptionalParseFile, andParseEnvwill now actively check if there is a loading loop and throwParsingTriedToCreateALoop.Previously, this could result in unexpected behaviors,
RecursionError, or infinite loops and was not explicitly supported and warned against.
2.0.0
⚠️ Breaking Changes ⚠️
YAML Version 1.2 is the default supported version.
Reason: Switched from
PyYAMLtoruamel.yaml, becausePyYAMLis very dead.yes/no,y/n,on/offare no longerboolOctal support is clearer:
010means 10,0o10means 8.Mitigation: YAML 1.1 support can be explicit enabled by using the
%YAML 1.1 ---directive
jsonpath-rwcannot be installed aside this library.Reason: Switched from
jsonpath-rwtopython-jsonpath, becausejsonpath-rwis very dead.Both
jsonpath-rwandpython-jsonpathcannot be installed.jsonpath-rwcontrolsjsonpath_rwandjsonpathmodules (despite not explicitly needing the latter).python-jsonpathalso controlsjsonpath, but looses injsonpath-rw.ImportErroroccur on thejsonpathmodules when both are installed.
Configurationno longer fakes being a subclass ofdict.It remains a
Mapping.dictinheritance was done for compatible withjson.dumpsand other libraries that only support the primitivedict, instead ofMapping. However, faking the inheritance has always been sketchy andjson.dumpshas failed in rare occurrences.Mitigation: Used one of the following methods:
json.dumps(config.as_dict())json.dumps(config, default=granular_configuration_language.json_default)config.as_json_string()
Configuration is immutable by default now.
ConfigurationandLazyLoadConfigurationare now immutable mappings.Immutable sequences use
tupleis used instead oflistMitigation: Use
MutableLazyLoadConfigurationin-place ofLazyLoadConfiguration.This uses
MutableConfigurationinstead ofConfigurationandlistfor sequences.MutableConfigurationis a subclass ofConfigurationandMutableLazyLoadConfigurationis a subclass ofLazyLoadConfiguration, so anyisinstancecheck can remain as they were.If you need to dynamically set settings at runtime,
LazyLoadConfigurationnow providesinject_beforeandinject_afteras immutable way of handling this case.
Depreciated Features removed:
set_config/get_configpatternINI support
Configuration patching
ConfigurationFilesandConfigurationMultiNamedFilesclasses have been removed.LazyLoadConfigurationonly supports paths (e.g.pathlib.Pathandstr).Mitigation: Just use
pathlib.Pathorstrdirectly.
Renamed Exceptions:
ParseEnvError→ParseEnvParsingErrorParseEnvEnvironmentVaribleNotFound→EnvironmentVaribleNotFoundJSONPathQueryMatchFailed→JSONPathQueryFailedJSONPathMustStartFromRoot→RefMustStartFromRoot
Previously, YAML Mappings could not override non-Mappings. This has been changed to be more consistent with merge outcomes being “to merge” or “to replace”.
Changed
Switched from
PyYAMLtoruamel.yamlNote:
PyYAMLis very deadThis primarily means YAML Version 1.2 is the default supported version.
yes/no,y/n,on/offare no longerboolOctal support is clearer:
010means 10,0o10means 8.
YAML 1.1 support can be explicit enabled by using the
%YAML 1.1 ---directive
Switched from
jsonpath-rwtopython-jsonpathNote:
jsonpath-rwis very deadImportant: Both
jsonpath-rwandpython-jsonpathcannot be installed.jsonpath-rwcontrolsjsonpath_rwandjsonpathmodules (despite not explicitly needing the latter).python-jsonpathalso controlsjsonpath, but loses tojsonpath-rw.ImportErroroccur on thejsonpathmodules when both are installed.
Renamed
granular_configuration.yaml_handlermodule togranular_configuration.yamlConfiguration no longer fakes being a subclass of
dict.It remains a
MutableMapping.dictinheritance was done for compatible withjson.dumpsand other library that only support the primitivedict, instead ofMapping. However, faking the inheritance has always been sketchy andjson.dumpshas failed in rare occurrences.json_defaultis behavior to enablejson.dumpsupport.
Previously, YAML Mappings could not override non-Mappings. This has been changed to be more consistent with merge outcomes being “to merge” or “to replace”.
Renamed Exceptions:
ParseEnvError→ParseEnvParsingErrorParseEnvEnvironmentVaribleNotFound→EnvironmentVaribleNotFoundJSONPathQueryMatchFailed→JSONPathQueryFailedJSONPathMustStartFromRoot→RefMustStartFromRoot
(internal detail)
LazyEval.run()usage replaced withLazyEval.result
Added
Add JSON Pointer support where JSON Path is supported.
Added the following tags:
Manipulators:
!Del,!Merge,!RefParsers:
!ParseEnvSafe,ParseFile,ParseFileOptionalTypers:
!Date,!DateTime,!UUIDNote:
python-dateutilis used for Python 3.10
Added
Configuration.typed_getIntroduced
mutable_configurationflag, with immutable as default.Configurationis no longer aMutableMapping, justMapping.MutableConfigurationhas been added to extend back theMutableMappinginterfaceLazyLoadConfigurationno longer provides aMutableMappinginterface, justMappingMutableLazyLoadConfigurationhas been added to extend back theMutableMappinginterface and remove needing to cast toMutableConfigurationWhen immutable,
tupleis used instead oflistLazyLoadConfigurationnow providesinject_beforeandinject_afteras immutable way of dynamically setting settings at runtime.
Added: JSON Pointer for base_path
Added Plugin support for adding external Tags
Added
G_CONFIG_DISABLE_PLUGINSandG_CONFIG_DISABLE_TAGSas supported environment variables to disable select tags.Added
mergeto enable multistep configuration loading.Configurationusingtyping.dataclass_transformto support typed attributes.Configuration.as_typedandLazyLoadConfiguration.as_typedadded enable typing.
Fixed
(internal detail) Fixed
LazyEvalmaking copies ofRootNote: Copying with
LazyEvalstill links copies unexpectedly. Now, it is just always connected to the original root (immutability is default now, so only copy immutable configurations).
Removed
Removed
set_configpatternRemoved INI support
Completely internalized location logic, removing
ConfigurationFiles,ConfigurationMultiNamedFiles. Just usepathlib.Pathorstr.
1.8.0
Changed
Adds
!SubTag
1.5.0
Changed
Adds
!ParseEnvTag
1.4.0
Changed
Adds
InvalidBasePathExceptionas an exception that can be thrown during the load phase ofLazyLoadConfiguration.This subclasses
KeyErrormaintaining compatibility with the state before this exception.
LazyLoadConfiguration’sbase_pathargument now takes a singlestrin addition to the originaltyping.Sequence[str]
1.3.1
Changed
Adds clear_config
1.3
Changed
Adds string path support to
LazyLoadConfigurationAdds
set_config/get_configpatternAdds
Configuration.patch
1.2
Changed
Adding INI support
1.1
Changed
Adds
!PlaceholderTagMakes tags evaluate lazily (i.e. at first use)