conda-forge / conda-smithy

The tool for managing conda-forge feedstocks.
https://conda-forge.org/
BSD 3-Clause "New" or "Revised" License
146 stars 169 forks source link

refactor: ruamel #1964

Open AlbaHerrerias opened 1 week ago

AlbaHerrerias commented 1 week ago

Checklist

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:

https://github.com/conda-forge/conda-smithy/blob/9e4720fc497f45f45d7bd319a354c762992c530d/conda_smithy/variant_algebra.py#L55

https://github.com/conda-forge/conda-smithy/blob/9e4720fc497f45f45d7bd319a354c762992c530d/conda_smithy/configure_feedstock.py#L2608

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