Skip to content
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

refactor: ruamel #1964

Draft
wants to merge 8 commits into
base: main
Choose a base branch
from

Conversation

AlbaHerrerias
Copy link

Checklist

  • Added a news entry

One of the tasks in our STF work for Conda is to modernize conda-smithy's codebase. A work item is to unify the two YAML libraries currently in use: ruamel and PyYAML. We were advised to replace PyYAML with ruamel, as ruamel preserves comments in YAML documents. However, we found that the usage of PyYAML's BaseLoader in these two places:

content = yaml.load(contents, Loader=yaml.loader.BaseLoader) or {}

yaml.load(contents, Loader=yaml.loader.BaseLoader) or {}

are crucial to the current behaviour of conda-smithy, because it preserves all keys and values as strings, rather than parsing them. We believe this is necessary to prevent mishandling unquoted version numbers. Unfortunately, we were unable to replicate this behaviour using ruamel.

The possible outcomes we see so far for this work are:

  1. The preservation of comments are not as important as the unification of the libraries, which means ruamel should be the one being deprecated in favour of PyYAML
  2. The need to 100% backwards-compatible behaviour matching is not as important as the unification of the libraries, which means PyYAML should be deprecated
  3. We leave this as is, as a proof of concept for future reference, in case it's useful.

Thank you for your feedback

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants