Skip to content

Removal of ruamel

Matias Guijarro requested to merge noruamel into master

This is an attempt to remove the dependency on ruamel.

Indeed, there is the following problem with ruamel : newer versions introduced a change affecting our code (see merged PR !361 (merged)), that can be more or less solved (PR !361 (merged) again :P) but it is not so nice because it introduces !!omap directive in YAML files ; moreover newer versions do not work with Python 2.6. If we want to keep compatibility with Python 2.6 we must rely on an old ruamel ; but then, we don't benefit from bug fixes and improvements.

We mainly use ruamel for ordered keys in maps, and to save the yaml files. The ordered key problem is solved by this PR, just using the PyYAML package (see modified code - it comes from comes from http://stackoverflow.com/questions/5121931/in-python-how-can-you-load-yaml-mappings-as-ordereddicts), thus removing one of the main reason to use ruamel. The other thing is saving : with this PR, yml files are saved consistently (as the associated test shows). However the file indentation and spacing is reformatted the first time... Which can be a problem if yml files are under revision control since all the file will be reported as changed the first time they are saved.

I would say it's better to remove ruamel first, to get rid of a dependency and to be free from Python 2.6/2.7 problems, and solve this second problem in another issue. What do you want to do ?

PS: we said ruamel to be an optional dependency ; when saving files, if ruamel is not there, I think the whole file contents get reformatted just like with this PR

Merge request reports