Add safe YAML file reading and writing - #196
Open
Gonghan-Princess wants to merge 3 commits into
Open
Gonghan-Princess wants to merge 3 commits into
Gonghan-Princess wants to merge 3 commits into
Conversation
fabiocaccamo
previously approved these changes
Oct 1, 2026
fabiocaccamo
approved these changes
Oct 1, 2026
fabiocaccamo
requested changes
Oct 1, 2026
fabiocaccamo
left a comment
Owner
There was a problem hiding this comment.
@Gonghan-Princess thank you for this PR. I updated the requirements to avoid an error in the CI, but there is still a failing test, could you fix it please?
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.
Summary
Fixes #43.
read_file_yamlandwrite_file_yamlhelpers for a single YAML document, using PyYAML's safe loader and dumper.python-fsutil[yaml]and a lazy dependency check with an actionable installation hint; importing fsutil does not require PyYAML.Validation
Tested on Windows with Python 3.12.10 and PyYAML 6.0.3:
python -m pre_commit run --all-files --show-diff-on-failure: all configured checks passed, including mypy.python setup.py bdist_wheel, checked its conditional PyYAML dependency and source contents, and ran the README examples against the built wheel.The local environment has no pip module, so the initial pip-wheel command could not run; the wheel was subsequently built successfully with setuptools. Existing setuptools deprecation warnings remain. Other operating systems and Python versions were not run locally.
AI assistance
AI assisted with implementation, regression tests, validation, and this description. The contributor remains responsible for this submission. No third-party source code was copied; PyYAML is declared as an optional runtime dependency.