From 5e9d64e121eded86667ac9adb432cae0e45e95e6 Mon Sep 17 00:00:00 2001 From: Nathan McDougall Date: Tue, 2 Jun 2026 15:32:38 +1200 Subject: [PATCH 1/3] chore: draft 0.6.0 changelog and update README with merge() method --- CHANGELOG.md | 60 ++++++++++++++++++++++++++++++++++++++++++++++++++++ README.md | 2 ++ 2 files changed, 62 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index b7175dd..5a93c73 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,64 @@ # Changelog +## 0.6.0 + +### Features + +- Added `merge()` method to `Document` and `Editor` for recursive mapping merging with deep value updates. +- Added `find_index()` for searching list-of-dicts by matching fields, returning the index of the first matching element. +- Added `ensure_in_list()` for appending a value to a list only if it's not already present. +- Added `RoutingError(PatchError)` to the error hierarchy for non-mapping route failures. Operations that attempt to navigate through non-mapping nodes now raise `RoutingError` instead of generic errors. +- Enhanced error messages with human-readable path formatting in `NodeTypeError` messages for clarity. +- Added basedpyright type checking for improved static type verification. + +### Fixes + +- Fixed naive colon finder that corrupted quoted keys containing colons (#46). +- Replaced unsafe byte indexing with upfront span validation to prevent index-out-of-bounds errors (#45). +- Fixed nested dict flattening in `_create_at` that could lose intermediate keys during upsert operations (#42). +- Added support for upsert operations into empty documents without requiring sentinel workaround (#35). + +### Internal + +- Centralized patch-error classification and applied stepdown rule for better error type hierarchy management (#47). + +### Documentation + +- Added `NodeTypeError` and `RoutingError` to README error hierarchy documentation (#49). + +### Testing + +- Added `test_api_contracts` to verify Editor/Document method coverage and consistency (#52). +- Added tests verifying `NodeTypeError` is catchable as both `PatchError` and `TypeError` (#51). +## 0.6.0 + +### Features + +- Added `merge()` method to `Document` and `Editor` for recursive mapping merging with deep value updates. +- Added `find_index()` for searching list-of-dicts by matching fields, returning the index of the first matching element. +- Added `ensure_in_list()` for appending a value to a list only if it's not already present. +- Added `RoutingError(PatchError)` to the error hierarchy for non-mapping route failures. Operations that attempt to navigate through non-mapping nodes now raise `RoutingError` instead of generic errors. +- Enhanced error messages with human-readable path formatting in `NodeTypeError` messages for clarity. +- Added basedpyright type checking for improved static type verification. + +### Fixes + +- Fixed naive colon finder that corrupted quoted keys containing colons. +- Replaced unsafe byte indexing with upfront span validation to prevent index-out-of-bounds errors. +- Fixed nested dict flattening in `_create_at` that could lose intermediate keys during upsert operations. +- Added support for upsert operations into empty documents without requiring sentinel workaround. + +### Internal + +- Centralized patch-error classification and applied stepdown rule for better error type hierarchy management. + +### Documentation + +- Added `NodeTypeError` and `RoutingError` to README error hierarchy documentation. + +### Testing + +- Added `test_api_contracts` to verify Editor/Document method coverage and consistency. +- Added tests verifying `NodeTypeError` is catchable as both `PatchError` and `TypeError`. ## 0.5.0 diff --git a/README.md b/README.md index a98ce3a..0d12402 100644 --- a/README.md +++ b/README.md @@ -82,6 +82,7 @@ doc.remove_from_list("items", values=["a"]) doc.ensure_in_list("items", value="c") # no-op if already present doc.ensure_in_list("repos", where={"name": "x"}, value={"name": "x", "version": "1.0"}) doc.sync("items", value=["a", "new", "b"]) # minimal diff-and-patch +doc.merge("config", value={"debug": True, "level": 2}) # recursive mapping merge doc.find_index("repos", where={"id": "x"}) # find in list-of-dicts; returns int | None doc.query("items") # Feature with location info @@ -103,6 +104,7 @@ with yamltrip.edit("config.yml") as ed: ed.upsert("new_key", value="new_value") ed.remove("old_key") ed.sync("deps", value={"a": "1.0", "b": "2.0"}) # minimal patching + ed.merge("settings", value={"debug": True, "level": 2}) # recursive merge print(ed["version"]) # "2.0" print(ed.get("missing")) # None print(ed.original["version"]) # original value before edits From 506d8094d94b2f6dca350f4be713f63e72c9ecdd Mon Sep 17 00:00:00 2001 From: Nathan McDougall Date: Tue, 2 Jun 2026 15:35:46 +1200 Subject: [PATCH 2/3] Bump 0.5.0 -> 0.6.0 --- Cargo.lock | 2 +- Cargo.toml | 2 +- pyproject.toml | 2 +- uv.lock | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index d80b019..8a6c5c8 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -466,7 +466,7 @@ dependencies = [ [[package]] name = "yamltrip" -version = "0.5.0" +version = "0.6.0" dependencies = [ "indexmap", "pyo3", diff --git a/Cargo.toml b/Cargo.toml index 5044dba..059eb47 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "yamltrip" -version = "0.5.0" +version = "0.6.0" edition = "2024" license = "MIT" diff --git a/pyproject.toml b/pyproject.toml index 31afca7..618183c 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,7 @@ requires = [ "maturin>=1.0,<2.0" ] [project] name = "yamltrip" -version = "0.5.0" +version = "0.6.0" description = "A round-tripping YAML library for Python" readme = "README.md" authors = [ { name = "Nathan McDougall", email = "nathan.j.mcdougall@gmail.com" } ] diff --git a/uv.lock b/uv.lock index d965390..5d99fe6 100644 --- a/uv.lock +++ b/uv.lock @@ -880,7 +880,7 @@ wheels = [ [[package]] name = "yamltrip" -version = "0.5.0" +version = "0.6.0" source = { editable = "." } dependencies = [ { name = "typing-extensions" }, From aa6a84a29c5689daa1b57aaa3dbcfd81ef3462f7 Mon Sep 17 00:00:00 2001 From: Nathan McDougall Date: Tue, 2 Jun 2026 15:41:20 +1200 Subject: [PATCH 3/3] Fix duplication in 0.6.0 changelog --- CHANGELOG.md | 29 ----------------------------- 1 file changed, 29 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5a93c73..d3b7fbe 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,34 +1,5 @@ # Changelog -## 0.6.0 - -### Features - -- Added `merge()` method to `Document` and `Editor` for recursive mapping merging with deep value updates. -- Added `find_index()` for searching list-of-dicts by matching fields, returning the index of the first matching element. -- Added `ensure_in_list()` for appending a value to a list only if it's not already present. -- Added `RoutingError(PatchError)` to the error hierarchy for non-mapping route failures. Operations that attempt to navigate through non-mapping nodes now raise `RoutingError` instead of generic errors. -- Enhanced error messages with human-readable path formatting in `NodeTypeError` messages for clarity. -- Added basedpyright type checking for improved static type verification. - -### Fixes - -- Fixed naive colon finder that corrupted quoted keys containing colons (#46). -- Replaced unsafe byte indexing with upfront span validation to prevent index-out-of-bounds errors (#45). -- Fixed nested dict flattening in `_create_at` that could lose intermediate keys during upsert operations (#42). -- Added support for upsert operations into empty documents without requiring sentinel workaround (#35). - -### Internal - -- Centralized patch-error classification and applied stepdown rule for better error type hierarchy management (#47). - -### Documentation - -- Added `NodeTypeError` and `RoutingError` to README error hierarchy documentation (#49). - -### Testing -- Added `test_api_contracts` to verify Editor/Document method coverage and consistency (#52). -- Added tests verifying `NodeTypeError` is catchable as both `PatchError` and `TypeError` (#51). ## 0.6.0 ### Features