-
Notifications
You must be signed in to change notification settings - Fork 282
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Migrate the python workflows yaml module to use ruamel.yaml
#2614
Comments
Files that need to be changed (Please add more if I have missed)
|
The Synk profile for While the claimed improvements from YAML 1.2 support are significant, there are a number of red flags:
I'm not affiliated with either parser or with opensearch. I came here trying to decide for myself which parser to use. |
Hey @jace thanks for the inputs, also I found this useful https://stackoverflow.com/questions/20805418/pyyaml-dump-format/36760452#36760452, in terms of maintenance I see |
I don't have a strong opinion about whether these red flags should prevent anyone from using ruamel.yaml. Sounds like it was added in #2602 to avoid having to explicitly lint updated .yaml files. Why wasn't it an issue with other YML files created? @prudhvigodithi do you have an example of differences when PyYaml is used vs. ruamel.yaml for the file you are modifying in #2602? |
Is your feature request related to a problem? Please describe
Coming from the PR, which requires the modification version increment workflow to auto add the branch entry, as part of developing this automation, the package
ruamel.yaml
, seems to be a better fit when compared toPyYaml
. My proposal is to have a single library for yaml parsing and useruamel.yaml
as it makes it simple to work on complex yaml parsing.Using ruamel.yaml it's easy to override the methods like
explicit_start
,preserve_quotes
and rightindent
which honors yamllint and gh workflow .yml rules.ruamel.yaml
also does not change the on key to boolean (default the library considers on as boolean) which is not easy with PyYAML, need some extra logic to create constructer and override methods.https://stackoverflow.com/questions/36463531/pyyaml-automatically-converting-certain-keys-to-boolean-values
---, this is also preserved with ruamel.yaml easily compared to PyYAML, without this the GH and yamllint flags it as error.
Describe the solution you'd like
Use
ruamel.yaml
Some more useful details: https://snyk.io/advisor/python/ruamel-yaml
ruamel.yaml
difference withPyYAM
L: https://yaml.readthedocs.io/en/latest/pyyaml.html#Describe alternatives you've considered
No response
Additional context
cookiecutter migration to ruamel.yaml cookiecutter/cookiecutter#557
The text was updated successfully, but these errors were encountered: