[WIP] Final migration to configuration version 1: structured and validated configs by deruyter92 · Pull Request #3198 · DeepLabCut/DeepLabCut
- reading breaks for corrupted yaml - added tests for prefered behavior that is currently not implemented (yaml safeloading and validating config keys)
This mixin provides methods for:
- Loading configurations from dictionaries or YAML files
- Validating configuration data against pydantic models
- Converting configurations to dictionaries
- Pretty printing configuration data
add imports from utils
- Introduced new configuration classes for inference, logging, model, pose, project, runner, and training settings. - Refactored data loading mechanisms to utilize new configuration structures. - Moved the multithreading and compilation options in inference configuration to the config module. - Typed configuration for logging. - Updated dataset loaders to accept model configurations directly or via file paths.
(The fields are kept identical to old multianimal project configs for now) move ProjectConfig to deeplabcut/core/config
…fig/dict/None-type handling. C3-II Additional refactoring of configurations Part 3-II of migration to typed configs, see issue #3193
…ith validate_assignment=True) This is necessary to prevent a bug: The isinstance(data, cls): return data shortcut in MigrationMixin.migrate_then_validate (a model_validator(mode="wrap")). Pydantic re-enters this validator during validate_assignment, passing the current instance as data. The shortcut returned it unchanged, silently discarding every field update. This broke all assignment — not just validation, but even plain cfg.count = 42 was a no-op. The problem is that model_validator(mode="wrap") wraps the entire validation pipeline, including validate_assignment flow. Migration should only run during construction, not on every field assignment. The clean solution is to switch from mode="wrap" to mode="before" — it transforms raw input data before validation and doesn't participate in validate_assignment at all.
Part 4 of migration to typed configs, see issue #3193
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