Update None-type validation for legacy ProjectConfig templates Remove ignore_empty - #3439
Open
deruyter92 wants to merge 4 commits into
Open
Update None-type validation for legacy ProjectConfig templates Remove ignore_empty#3439deruyter92 wants to merge 4 commits into
None-type validation for legacy ProjectConfig templates Remove ignore_empty#3439deruyter92 wants to merge 4 commits into
Conversation
Extend ProjectConfig.normalize_legacy_empty_vales to treat a bare/null YAML value as unset for fields whose type doesn't accept None (e.g. multianimalproject). This is required to universally support legacy config templates with unset fields.
Mark the parameter as deprecated in utils.read_config. This parameter was only needed for supporting empty values in legacy project configs. Instead, currently a more strict policy is enforced: null/empty is loaded as None, and fails validation if not supported. since f7305aa None-type support specifically for ProjectConfigs is tolerated using an after validator, which makes the current `ignore_empty` parameter obsolete
ignore_emptyNone-type validation for legacy ProjectConfig templates Remove ignore_empty
Contributor
There was a problem hiding this comment.
Pull request overview
This PR removes the legacy ignore_empty option from DLCBaseConfig.from_yaml() and shifts legacy “bare/null YAML key” handling into ProjectConfig validation so that from_dict() and from_yaml() behave consistently when configs contain placeholder null values.
Changes:
- Removed
ignore_emptyfromDLCBaseConfig.from_yaml()and updatedread_config()to deprecate (and ignore)ignore_empty. - Added/extended
ProjectConfig.normalize_legacy_empty_values()to treat top-levelNonevalues as “unset” only for non-optional fields, emitting a warning. - Added tests covering legacy null/empty handling for both
ProjectConfigentrypoints andread_config().
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
deeplabcut/core/config/base_config.py |
Removes ignore_empty handling from base YAML loader to unify behavior. |
deeplabcut/core/config/project_config.py |
Adds validator logic to normalize legacy None placeholders and warn. |
deeplabcut/core/config/utils.py |
Deprecates ignore_empty parameter in read_config() and routes to ProjectConfig.from_yaml() without it. |
tests/core/config/test_project_config.py |
Adds unit tests for normalization of legacy empty/null values and parity between from_dict()/from_yaml(). |
tests/core/config/test_core_config.py |
Adds tests for read_config() behavior with null placeholders and deprecation warning behavior. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
deruyter92
marked this pull request as ready for review
August 9, 2026 13:35
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Motivation:
Currently, template project configurations may contain placeholder fields with empty values. Even when the schema does not allow
None-type.e.g.
To make the validation flexible,
ProjectConfig.from_yaml(..., ignore_empty=True)always droppedNone-type values, treating empty yaml fields as unset. However, this caused two issues:from_yamlbut not forfrom_dict, yielding different validation behavior betweenProjectConfig.from_dict(read_config_as_dict("config.yaml")(strict) andProjectConfig.from_yaml("config.yaml")(None-type allowed)None-types whenignore_emptyisTrue, treating it as unset. Which is conceptually an unclear policy.The current PR changes this by removing the
ignore_emptyparameter and adding instead a ProjectConfig validator that treats top-levelNone-types as unset, emitting an actionable warning.Changes
DLCBaseConfig.from_yaml(): remove theignore_emptyparameter (core.config.utils.read_config(): deprecateignore_emptyparameterNone-type validation in existing validatorProjectConfig.normalize_legacy_empty_values()ProjectConfig.normalize_legacy_empty_values()andcore.config.utils.read_config()