From 0b6311abb61442506e81ca373b0d573ba4d4816c Mon Sep 17 00:00:00 2001 From: Christian Monch Date: Tue, 7 Jul 2026 11:53:08 +0200 Subject: [PATCH] use canonical form for change set content This PR sorts JSON output in change sets. This should mininmize noise that was due to a swapped order of keys. Note: this code will not sort lists, that are contained in a JSON object. --- .../commands/dtc_plugins/auto_curate.py | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/dump_things_pyclient/commands/dtc_plugins/auto_curate.py b/dump_things_pyclient/commands/dtc_plugins/auto_curate.py index 78c8c86..6f055b2 100644 --- a/dump_things_pyclient/commands/dtc_plugins/auto_curate.py +++ b/dump_things_pyclient/commands/dtc_plugins/auto_curate.py @@ -639,7 +639,12 @@ def _update_change_set( console.print(f'[DRY_RUN]:STORE existing record [green]"{record["pid"]}"[/green] of class "{class_name}" from curated area at "{file_path.resolve()}"') else: file_path.write_text( - json.dumps(existing_record, ensure_ascii=False, indent=2) + '\n', + json.dumps( + existing_record, + ensure_ascii=False, + indent=2, + sort_keys=True, + ) + '\n', encoding='utf8' ) else: @@ -672,7 +677,11 @@ def _update_change_set( console.print(f'[DRY_RUN]:STORE annotations for record [green]"{record["pid"]}"[/green] of class "{class_name}" from curated area at "{annotation_path.resolve()}"') else: annotation_path.write_text( - json.dumps(annotations, ensure_ascii=False) + '\n', + json.dumps( + annotations, + ensure_ascii=False, + sort_keys=True, + ) + '\n', encoding='utf8' ) -- 2.52.0