diff --git a/python/lsst/daf/butler/formatters/yaml.py b/python/lsst/daf/butler/formatters/yaml.py index 743c18af25..68d64ad958 100644 --- a/python/lsst/daf/butler/formatters/yaml.py +++ b/python/lsst/daf/butler/formatters/yaml.py @@ -180,7 +180,7 @@ def _toBytes(self, inMemoryDataset: Any) -> bytes: unsafe_dump = self.writeParameters.get("unsafe_dump", False) if unsafe_dump: - serialized = yaml.dump(inMemoryDataset) + serialized = yaml.dump(inMemoryDataset, sort_keys=False) else: - serialized = yaml.safe_dump(inMemoryDataset) + serialized = yaml.safe_dump(inMemoryDataset, sort_keys=False) return serialized.encode()