Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
60 changes: 60 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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

Expand Down
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "yamltrip"
version = "0.5.0"
version = "0.6.0"
edition = "2024"
license = "MIT"

Expand Down
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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" } ]
Expand Down
2 changes: 1 addition & 1 deletion uv.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading