Changelog
Next
Refactored
Refactored
as_dict
to use dict comprehension.
2.3.1
Added
Added doc-strings to
Configuration.copy
andMutableConfiguration.copy
methods.Added parameters to
Configuration.__init__
andMutableConfiguration.__init__
documentationDuplicated overloads to improve
MutableConfiguration
documentation.
Fixed
Baked-In Documentation: Corrected grammar in Project description and Readme.
EagerIOBinaryFile
,EagerIOTextFile
: Updated to excludedata
fromrepr
andhash
.Added Generic Type Parameters to
MutableConfiguration
Both default to
typing.Any
, so no behavior change.Should have been updated alongside
Configuration
.
KT
is now bound tocollections.abc.Hashable
Allows type checking to catch what is a runtime error.
2.3.0
Added
Added
granular_configuration_language.yaml.file_ops
moduleRefactored from private modules.
Added EagerIO Feature Set
(internal detail) Added
SimpleFuture
to wrapThreadPoolExecutor
setup and teardown.Added
granular_configuration_language.yaml.decorator.eagerio
moduleAdded
LazyLoadConfiguration.eager_load
Added
!EagerParseFile
and!EagerOptionalParseFile
TagsAdded Undocumented Tags:
!LoadBinary
and!EagerLoadBinary
Tag to test binary EagerIO
Added
granular_configuration_language.yaml.decorators.with_tag
decoratorRewrote tag attribute tracking to add support.
G_CONFIG_ENABLE_TAG_TRACKER
environment variable setting removed.
Added
TagHadUnsupportArgument
exception.Inherits from
ValueError
, which was previously used.
Added Generic Type Parameters to
Configuration
Both default to
typing.Any
, so no behavior change.
Changed
Changes to
available_plugins
:Added
-l
,--long
optionAdded
eager_io
columnAdded shorten name option for
handler
,needs_root_condition
, andeager_io
.Defaults as enabled.
-l
,--long
option disables.
Changed internal Tag Function names to be shorter for
handler
column.Improved
--help
message.Help message uses
python -m granular_configuration_language.available_plugins
instead ofavailable_plugins.py
(Backported from 3.14)
Changes to
available_tags
:Added
eio_inner_type
columnImproved
--help
message.Help message uses
python -m granular_configuration_language.available_tags
instead ofavailable_tags.py
(Backported from 3.14)
A
ValueError
raised during the type check ofTagDecoratorBase
will 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.get
type signature to match Python 3.12Mapping.get
signature.i.e.
key
is 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_ref
interpolations missing parentheses.!OptionalParseFile
is documented to returnNone
. It was returning empty mapping. Changed to result to match documentation.
2.2.2
Added
Added
needs_root_condition
column toavailable_plugins
.G_CONFIG_ENABLE_TAG_TRACKER
to Environment Variables.
Changed
Made tag attribute tracking optional via
G_CONFIG_ENABLE_TAG_TRACKER
.available_plugins
andavailable_tags
setG_CONFIG_ENABLE_TAG_TRACKER
temporarily.
!Masked
is now lazy, for consistency withinterpolate_value_without_ref
recommendations.Improved documentation.
2.2.1
Changed
SafeConfigurationProxy
is now registered as a subclass ofConfiguration
.Updated many doc-strings to improve generated documentation.
2.2.0
Added
python -m granular_configuration_language.available_tags
is publicly usable nowpython -m granular_configuration_language.available_plugins
Changed
Refactored
load_file
andmake_chain_message
to make testing easier
2.1.0
Changed
!ParseFile
,!OptionalParseFile
, andParseEnv
will 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
PyYAML
toruamel.yaml
, becausePyYAML
is very dead.yes/no
,y/n
,on/off
is no longerbool
Octal support is clearer:
010
means 10,0o10
means 8.Mitigation: YAML 1.1 support can be explicit enabled by using the
%YAML 1.1 ---
directive
jsonpath-rw
cannot be installed aside this library.Reason: Switched from
jsonpath-rw
topython-jsonpath
, becausejsonpath-rw
is very dead.Both
jsonpath-rw
andpython-jsonpath
cannot be installed.jsonpath-rw
controlsjsonpath_rw
andjsonpath
modules (despite not explicitly needing the latter).python-jsonpath
also controlsjsonpath
, but looses injsonpath-rw
.ImportError
occur on thejsonpath
modules when both are installed.
Configuration
no longer fakes being a subclass ofdict
.It remains a
Mapping
.dict
inheritance was done for compatible withjson.dumps
and other libraries that only support the primitivedict
, instead ofMapping
. However, faking the inheritance has always been sketchy andjson.dumps
has 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.
Configuration
andLazyLoadConfiguration
are now immutable mappings.Immutable sequences use
tuple
is used instead oflist
Mitigation: Use
MutableLazyLoadConfiguration
in-place ofLazyLoadConfiguration
.This uses
MutableConfiguration
instead ofConfiguration
andlist
for sequences.MutableConfiguration
is a subclass ofConfiguration
andMutableLazyLoadConfiguration
is a subclass ofLazyLoadConfiguration
, so anyisinstance
check can remain as they were.If you need to dynamically set settings at runtime,
LazyLoadConfiguration
now providesinject_before
andinject_after
as immutable way of handling this case.
Depreciated Features removed:
set_config
/get_config
patternINI support
Configuration patching
ConfigurationFiles
andConfigurationMultiNamedFiles
classes have been removed.LazyLoadConfiguration
only supports paths (e.g.pathlib.Path
andstr
).Mitigation: Just use
pathlib.Path
orstr
directly.
Renamed Exceptions:
ParseEnvError
→ParseEnvParsingError
ParseEnvEnvironmentVaribleNotFound
→EnvironmentVaribleNotFound
JSONPathQueryMatchFailed
→JSONPathQueryFailed
JSONPathMustStartFromRoot
→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
PyYAML
toruamel.yaml
Note:
PyYAML
is very deadThis primarily means YAML Version 1.2 is the default supported version.
yes/no
,y/n
,on/off
is no longerbool
Octal support is clearer:
010
means 10,0o10
means 8.
YAML 1.1 support can be explicit enabled by using the
%YAML 1.1 ---
directive
Switched from
jsonpath-rw
topython-jsonpath
Note:
jsonpath-rw
is very deadImportant: Both
jsonpath-rw
andpython-jsonpath
cannot be installed.jsonpath-rw
controlsjsonpath_rw
andjsonpath
modules (despite not explicitly needing the latter).python-jsonpath
also controlsjsonpath
, but losses injsonpath-rw
.ImportError
occur on thejsonpath
modules when both are installed.
Renamed
granular_configuration.yaml_handler
module togranular_configuration.yaml
Configuration no longer fakes being a subclass of
dict
.It remains a
MutableMapping
.dict
inheritance was done for compatible withjson.dumps
and other library that only support the primitivedict
, instead ofMapping
. However, faking the inheritance has always been sketchy andjson.dumps
has failed in rare occurrences.json_default
is behavior to enablejson.dump
support.
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
→ParseEnvParsingError
ParseEnvEnvironmentVaribleNotFound
→EnvironmentVaribleNotFound
JSONPathQueryMatchFailed
→JSONPathQueryFailed
JSONPathMustStartFromRoot
→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
,!Ref
Parsers:
!ParseEnvSafe
,ParseFile
,ParseFileOptional
Typers:
!Date
,!DateTime
,!UUID
Note:
python-dateutil
is used for Python 3.10
Added
Configuration.typed_get
Introduced
mutable_configuration
flag, with immutable as default.Configuration
is no longer aMutableMapping
, justMapping
.MutableConfiguration
has been added to extend back theMutableMapping
interfaceLazyLoadConfiguration
no longer provides aMutableMapping
interface, justMapping
MutableLazyLoadConfiguration
has been added to extend back theMutableMapping
interface and remove needing to cast toMutableConfiguration
When immutable,
tuple
is used instead oflist
LazyLoadConfiguration
now providesinject_before
andinject_after
as 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_PLUGINS
andG_CONFIG_DISABLE_TAGS
as supported environment variables to disable select tags.Added
merge
to enable multistep configuration loading.Configuration
usingtyping.dataclass_transform
to support typed attributes.Configuration.as_typed
andLazyLoadConfiguration.as_typed
added enable typing.
Fixed
(internal detail) Fixed
LazyEval
making copies ofRoot
Note: Copying with
LazyEval
still 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_config
patternRemoved INI support
Completely internalized location logic, removing
ConfigurationFiles
,ConfigurationMultiNamedFiles
. Just usepathlib.Path
orstr
.
1.8.0
Changed
Adds
!Sub
Tag
1.5.0
Changed
Adds
!ParseEnv
Tag
1.4.0
Changed
Adds
InvalidBasePathException
as an exception that can be thrown during the load phase ofLazyLoadConfiguration
.This subclasses
KeyError
maintaining compatibility with the state before this exception.
LazyLoadConfiguration
’sbase_path
argument now takes a singlestr
in addition to the originaltyping.Sequence[str]
1.3.1
Changed
Adds clear_config
1.3
Changed
Adds string path support to
LazyLoadConfiguration
Adds
set_config
/get_config
patternAdds
Configuration.patch
1.2
Changed
Adding INI support
1.1
Changed
Adds
!Placeholder
TagMakes tags evaluate lazily (i.e. at first use)