Use ruamel.yaml in place of pyyaml #223
Labels
No labels
CRITICAL
Stale
WIP
bug
concept
coordinate
dataset
dependencies
documentation
duplicate
enhancement
github_actions
good first issue
help wanted
invalid
maintenance
maps
marker
mask
on hold
parcellation
preprocess
question
ready
storage
template-space
triage
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
juaml/junifer!223
Loading…
Reference in a new issue
No description provided.
Delete branch "update/ruamel.yaml"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
pyyamlis lacking two features which we are interested in:ruaml.yamlprovides support for them, so will be worth using it overpyyaml.Codecov Report
100.00% <ø> (ø)93.60% <100.00%> (ø)Flags with carried forward coverage won't be shown. Click here to find out more.
100.00% <ø> (ø)69.14% <100.00%> (-0.33%)96.23% <100.00%> (-0.03%)94.87% <100.00%> (-0.13%)97.67% <100.00%> (+0.17%)71.42% <100.00%> (ø)I just have a few clarification questions but that is it.
@ -24,3 +24,3 @@.. code-block:: bashconda env create -n <your-environment-name> -f conda-env.yml python=3.10conda env create -n <your-environment-name> -f conda-env.ymlWhat is the reason for not having to specify the python version in the command anymore?
Why does this not need a context manager anymore?
Same Q as above
@ -263,4 +276,4 @@generated_config_yaml_path = Path(tmp_path / "junifer_jobs" / "yaml_config_gen_check" / "config.yaml")Should you use CamelCase in the docstring here, similar to the DataGrabber issue?
@ -267,3 +280,2 @@with open(generated_config_yaml_path, "r") as f:yaml_config = yaml.unsafe_load(f)yaml_config = yaml.load(generated_config_yaml_path)# Check for correct YAML config generationShould you use CamelCase in the docstring here, similar to the DataGrabber issue?
@ -16,0 +19,4 @@yaml = YAML()yaml.default_flow_style = Falseyaml.allow_unicode = Trueyaml.indent(mapping=2, sequence=4, offset=2)So this is a global object that you import elsewhere to load files?
That's cause
ruamel.yamlallows you to write to files viastreamargument in thedumpfunction.@ -267,3 +280,2 @@with open(generated_config_yaml_path, "r") as f:yaml_config = yaml.unsafe_load(f)yaml_config = yaml.load(generated_config_yaml_path)# Check for correct YAML config generationYeah I was debating that and I followed what was there but fair point. I'll take care of that in a separate PR for all test functions.
@ -16,0 +19,4 @@yaml = YAML()yaml.default_flow_style = Falseyaml.allow_unicode = Trueyaml.indent(mapping=2, sequence=4, offset=2)Yeah cause now you gotta have an instance of
YAMLclass so doesn't make sense to create multiple objects if you have the same thing everywhere.@ -267,3 +280,2 @@with open(generated_config_yaml_path, "r") as f:yaml_config = yaml.unsafe_load(f)yaml_config = yaml.load(generated_config_yaml_path)# Check for correct YAML config generationok makes sense, fine by me!
and this takes care of closing the ressource?
Yes exactly.
@ -24,3 +24,3 @@.. code-block:: bashconda env create -n <your-environment-name> -f conda-env.yml python=3.10conda env create -n <your-environment-name> -f conda-env.ymlAs we have that constraint (
python=3.10) in theconda-env.ymland also this syntax is incorrect from what I remember.Same argument as above with the only change that
loadcan take care of opening the file.@ -263,4 +276,4 @@generated_config_yaml_path = Path(tmp_path / "junifer_jobs" / "yaml_config_gen_check" / "config.yaml")Resolving this as I'll take care of this in a separate PR.
Ship it!
Approved, thanks for your hard work on this!