-
Notifications
You must be signed in to change notification settings - Fork 226
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
[internal] Switch from PyYAML to Ruamel? #223
Comments
Referring to the discussion in #305:
[...]
I realize that the above will not allow linking the YAML input to line numbers. The YAML parser replacement seems essential for linking the error output to the input file. Based on #207 (comment) request for machine-readable output, the replacement would be beneficial for nanangp/vscode-wireviz-preview#7 |
I did a bit of research and found that https://github.com/nexB/saneyaml might be lower hanging fruit than Ruamel. EDIT: two further promising options are |
For anyone who wants to dive a bit deeper into the topic, I recommend reading the following document: https://eemeli.org/yaml/#parsing-yaml This comes from the library that is used to provide syntax highlighting and error checking in https://github.com/redhat-developer/YAML-language-server for VScode. It is not programmed in Python, but we might take advantage of the CLI that it provides: Side note: Graphviz dot is also supported in VScode through https://github.com/nikeee/dot-language-server |
To enable comparing the alternatives, we should list the goals we want to achieve by switching library. Unless all goals can be achieved, then I guess we also must rank the goals by importance. A few goal candidates:
|
Please extend the list of criteria with:
|
The parser might need to provide default values other than
Doing it vice-versa might be the better option. It just needs to assure that an empty string is not equal to Another use case is described in #273 (comment) about leaving some attributes undefined if they can be copied from connected wires. |
I would like to add another library with some interesting features to the list that should be evaluated: fabiocaccamo/python-benedict |
Note that PyYAML is making some progress towards YAML spec 1.2 support. A separate yamlcore package has been released on PyPi to enable compatibility, as announced here: yaml/pyyaml#555 (comment)
|
This would add support for YAML 1.2 and solve #213.
Meanwhile, YAML 1.2 support seems to still be an open issue for PyYAML.
Any opinions on this matter?
The text was updated successfully, but these errors were encountered: