fix ruamel.yaml dumping newline for long filenames#3140
fix ruamel.yaml dumping newline for long filenames#3140MMathisLab merged 4 commits intoDeepLabCut:mainfrom
Conversation
|
Also added a minor change to |
There was a problem hiding this comment.
Pull request overview
This PR fixes a bug in the ruamel.yaml library that causes corrupted YAML files when creating projects with long video paths containing spaces. The fix increases the width parameter before dumping to prevent long sequences from being moved to new lines.
Changes:
- Added
ruamelFile.width = 1_000_000before YAML dumping to prevent line breaks in long video paths - Refactored video collection logic in
create_new_projectto use Path objects consistently - Added comprehensive unit tests for video configuration scenarios including long paths, spaces, and various edge cases
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| tests/test_auxiliaryfunctions.py | Added blank line for formatting |
| tests/create_project/test_video_set_configuration.py | New test file with 253 lines covering various video path scenarios and edge cases |
| deeplabcut/utils/auxiliaryfunctions.py | Added width parameter fix for ruamel.yaml to prevent newline insertion in long strings |
| deeplabcut/create_project/new.py | Refactored video collection to use Path objects consistently |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
Shouldn't we have any coverage info in the thread from the CI tests @deruyter92 ? Is this something we need to setup ? |
…paths ruamel.yaml was inserting unintended newlines when dumping paths, leading to corrupted YAML files for long video paths containing spaces. Fixes DeepLabCut#3119 Co-authored-by: Copilot <[email protected]>
- also add unit tests for video set configuration (and move to separate file). - add typehints, remove unused packages
When providing an empty video directory to `create_new_project`, the empty directory was mistakenly treated as video file for which a symbolic link is created. The current commit fixes this unintended behaviour.
8949be8 to
654abf9
Compare
Yes good point. Let's address that in a separate PR. |
|
@MMathisLab @AlexEMG, I think we should merge this PR. Let me know what you think. |
Motivation
This PR fixes an issue with external package
ruamel.yaml, causing corrupted yaml files when creating a project with long video paths containing spaces. (Fixes #3119)Changes
deeplabcut.create_project.new: The create_project function unintendedly treated empty video directories as a video file, for which a symbolic link is created. This behavior is now fixed