ome / scc

OME tools for managing the Git(Hub) workflow
https://pypi.org/project/scc/
GNU General Public License v2.0
0 stars 15 forks source link

Always pass a Loader argument to yaml.load #274

Closed sbesson closed 2 years ago

sbesson commented 2 years ago

Since PyYAML 5.1, calling yaml.load() without specifying a Loader argument is deprecated. With the release of PyYAML 6.0 yesterday, the Loader is now a mandatory positional argument.

This causes scc commands loading YAML configurations e.g. merge --repository-config (see https://merge-ci.openmicroscopy.org/jenkins/job/BIOFORMATS-push/1006/console ) or the newly introduced bump-conda-version to fail on newly created environments - see also https://github.com/yaml/pyyaml/issues/576

This PR adjusts all usages of yaml.load() to pass Loader=yaml.FullLoader which is equivalent to the former call. This should make the library compatible with both PyYAML 5.x and PyYAML 6.x. The alternative would be to cap PyYAML to 5.x but this feels like a minimal change to maintain compatibility between both lines. The only open question is around the loader to use. feb2c22 uses the FullLoader which is identical to the previous call but there might be a case for tightening it to SafeLoader.

To test this PR:

sbesson commented 2 years ago

Merging and releasing to assess the impact on the rest of the CI pipeline.

sbesson commented 2 years ago

1a549992b223e95d80f368d72e3fb0f6473bc388 pushed (and released) to fix a regression in the bump-version-conda. I had overlooked the fact that ruamel.yaml introduced in https://github.com/ome/scc/pull/273 is a complete alternative topyyaml. There is likely a case for unifying.