Fix YAML anchor references in params.yaml by implementing NoAnchorDumper #941
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.

This PR fixes an issue where
params.yamlfiles sometimes contained unwanted YAML anchor references like&id001when the same object appeared multiple times in the data structure.Problem
PyYAML automatically generates anchor references when the same object is referenced multiple times to avoid duplication. For example:
While this is valid YAML, it creates confusing and unreadable configuration files that are harder to understand and maintain.
Solution
Implemented a custom
_NoAnchorDumperclass that inherits fromSafeDumperand overrides theignore_aliasesmethod to always returnTrue, preventing automatic anchor generation.Changes
_NoAnchorDumperand updatedparams.yamlanddvc.yamlgeneration_NoAnchorDumperand updated experiment info YAML generationResult
The same data now generates clean, readable YAML:
The fix maintains full semantic equivalence and backward compatibility while producing cleaner, more maintainable configuration files.
Fixes #940.
💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.