tanbro / pyyaml-include

yaml include other yaml
https://pypi.org/project/pyyaml-include/
GNU General Public License v3.0
77 stars 20 forks source link

yaml writer? #37

Closed lacraig2 closed 7 months ago

lacraig2 commented 10 months ago

This is an interesting project that I'd like to integrate into my tools. I'd like to know if there's any support or interest for a writer class that respects includes.

As an example I'll refer to the first example in the README. Once the data has been read and potentially changed I may want to change the value of file2 name to be "3".

When I use yaml to dump the new dictionary to disk it will ignore the file structure and overwrite the values into one file.

I'd like to know if there is a way to handle this such that the writer respects the existing structure. If not, is that something this project would be interested in?

tanbro commented 9 months ago

The library simply cannot write modified values back to YAML files yet.

Maybe we can do that by PyYAML 's Representer