Yamlpath Versions Save

YAML/JSON/EYAML/Compatible get/set/merge/validate/scan/convert/diff processors using powerful, intuitive, command-line friendly syntax.

v3.8.2

3 months ago

Enhancements:

  • The MergerConfig class now accepts overrides for config values as "keys" and "rules" keyword arguments to the constructor. Credit and my thanks go to https://github.com/leviem1!

BREAKING CHANGES:

  • Support for Python 3.6 has been dropped. This is forced by incompatibilities discovered with the latest version of pytest and because dependencies like dateutil and ruamel-yaml-clib no longer support Python 3.6. Support for Python 3.7 is tepid. While pytest is still working with Python 3.7, other dependencies are no longer supporting Python 3.7; however, the extensive tests for yamlpath show no issues with them, so far. For now, Python 3.12 support is pending, waiting for the dateutil library to resolve a DeprecationWarning regarding its use of datetime.datetime.utcfromtimestamp().

v3.8.1

6 months ago

Bug Fixes:

  • Fixed issue #220 reported by https://github.com/abramov-oleg wherein novel mergeat paths given to the yaml-merge tool with Array and Array-of-Hash data in the RHS document would cause an interminable loop that would max out CPU and eventually exhaust RAM.

v3.8.0

1 year ago

Enhancements:

  • The yaml-set and yaml-merge command-line tools now support a new option: --json-indent/-J. This applies only to JSON output. By default, JSON documents are written/printed as single-line documents. This new option enables users to vertically expand JSON output with a specified indentation size for nest levels.
  • Additional *YAMLPathExceptions have been added to increase the specificity of various error conditions. You do not need to change any of your code as a result of this change; all new exceptions are subclasses of the original YAMLPathException. The new exceptions include:
    • UnmatchedYAMLPathException: No matching nodes
    • DuplicateKeyYAMLPathException: Duplicate key creation attempted
    • TypeMismatchYAMLPathException: Data Type mismatch
    • BadAliasYAMLPathException: Anchor/Alias/YMK error
    • NoDocumentYAMLPathException: Attempt to delete the entire document
    • RecursionYAMLPathException: Recursion nesting error
  • The Processor class now enables consumers to verify whether a YAMLPath would resolve to at least one node in the present document. The result is a simple Boolean (True when the path resolves; False, otherwise). The document is not modified by this test. See: Processor.exists(yaml_path)

Bug Fixes:

  • Pursuant to the addition of the intersection operator (&) added in 3.7.0, the text of one of the YAMLPathExceptions has been updated: Former: Adjoining Collectors without an operator has no meaning; try + or - between them, {yaml_path} New: Adjoining Collectors without an operator has no meaning; try +, -, or & between them, {yaml_path}

v3.7.0

1 year ago

Enhancements:

  • Support for Python 3.11 has been added.
  • A new Search Keyword has been added, [unique([NAME])]. This operates against collections to return only values which have no duplicates within the collection; i.e.: [1, 2, 2, 3] has unique values, [1, 3]. The NAME argument is required when operating against Hashes (maps/dicts) and Arrays-of-Hashes (sequences/lists of maps/dicts) to identify which field/property to evaluate for uniqueness. This can be inverted to return only results which are duplicated within the collection.
  • A new Search Keyword has been added, [distinct([NAME])]. This operates against collections to return exactly one of every value within the collection, discarding duplicates; i.e.: [1, 2, 2, 3] has distinct values, [1, 2, 3]. The NAME argument is required when operating against Hashes (maps/dicts) and Arrays-of-Hashes (sequences/lists of maps/dicts) to identify which field/property to evaluate for uniqueness. This cannot be inverted.
  • Added a new Collector Math Operator: & (intersection) As in set mathematics, this yields only elements of two collections which are common to both collections. Unlike set mathematics, collections allow duplicate elements. If you need to enforce distinctness of the intersected results, use the [distinct([NAME])] Search Keyword against the collected result, as in ((list1)&(list2))[distinct([NAME])].

Bug Fixes:

  • A typographical error in yamlpath.enums has been corrected with backward- compatible adapters in place to support both the correct and incorrect spelling of PathSeparators (formerly PathSeperators). If the PathSeperators version appears in your own code, please update to the new spelling. The incorrectly spelled version of this enumeration is now deprecated and will be removed in a future release. Thanks go entirely to https://github.com/AndydeCleyre for working so hard to submit this fix!
  • Processor.get_nodes would emit a nonobvious error message when mustexist is left at its default value (False) and yaml_path contained ** or * segments. Now, these segment types are excluded from generating "missing" nodes; only nodes which exist can be matched by * and **. Credit and my thanks go to https://github.com/gdubicki for discovering and reporting this issue.

v3.6.9

1 year ago

Enhancements:

  • Partial support for updating bare Python dict and Python's native collections.OrderedDict data structures was removed in version 3.6.8 because compatible YAML/EYAML/JSON data never presented as these data types and if anyone ever attempted to update a key by reference in a dict or collections.OrderedDict, it would cause a Python stack dump due to neither supporting the required insert method, which is provided only by ruamel.yaml. This version not only restores this capability, but also solves the issue of missing support for the insert logic, where applicable. It also adds support for the ruamel.yaml.compat.ordereddict type. Thanks to https://github.com/tsinggggg for requesting this feature be added!

v3.6.8

1 year ago

Bug Fixes:

  • Changes to format and value of child nodes under Anchored Hashes (maps/dicts) caused unexpected expansion of the same key-value pair wherever a YAML Merge Key Aliased the affected Anchored Hash. Thanks to https://github.com/hemnstill for finding and reporting this issue!

Enhancements:

v3.6.7

1 year ago

Bug Fixes:

v3.6.6

1 year ago

Enhancements:

  • Support ruamel.yaml up to version 0.17.21.

Bug Fixes:

  • YAML timestamp values could not be created via yamlpath tools or its library, per http://yaml.org/type/timestamp.html. Thanks again go to https://github.com/AndydeCleyre!
    • CAUTION 1: ruamel.yaml seems to force all timestamps to UTC while it loads YAML/JSON/Compatible data. So, when the timestamp value contains time-zone data, it will be stripped off after it is applied to the timestamp value. The yamlpath library reverses this when emitting the affected values but if you attempt to load the timestamp values directly in the DOM, you'll end up with the UTC-converted value, stripped of any time-zone specification. If you need the original, unmodified data as a time-zone aware datetime.datetime value, pass it through the helper method, Nodes.get_timestamp_with_tzinfo(data: AnchoredTimeStamp).
    • CAUTION 2: In order to support timestamp parsing, this project now depends on the python-dateutil library. Be sure to install it!

v3.6.5

1 year ago

Bug Fixes:

  • When using EYAML with block formatted values on Windows, the block formatting was broken when written to YAML, corrupting the YAML file. Non-block formatted values were unaffected and this issue only affected Windows EYAML users.
  • EYAML values were not being decrypted when the result appeared in a list.
  • Boolean values were being unexpectedly output as base-10 representations of the binary values 1 (True) and 0 (False) when emitting to JSON after setting the Boolean. This change also brings this project into compilance with https://peps.python.org/pep-0632/. Many thanks to https://github.com/AndydeCleyre!

v3.6.4

2 years ago

Enhancements:

  • Support ruamel.yaml up to version 0.17.17.

Bug Fixes:

  • Refactored single-star wildcard segment (*) handling to enable filtering matches when subsequent segments exist; this fixes Issue #154.