Emitter (PyYaml, libyaml) settings so output is diff-friendly
Jeff Kowalczyk <jtk-/[email protected]>
| Newsgroups | gmane.text.yaml.general |
|---|---|
| Message-ID | <[email protected]> |
I'm inspired by [1] to resume investigating an old goal: YAML data storage in a version-control system, mainly for python programs. I'd like to emit YAML that will always be zero-diff for equal data, regardless of the circumstances under which the data was loaded. Q: Is that considered indempotence? If not, what is the term for it? Q: What parts of YAML 1.2 syntax would need to be constrained by the Emitter to achieve this? Obvious to me are: - ordering of mapping keys, without emitting an omap - a default format for folded scalar text - default date and other scalar formats But hopefully there is a way to know the complete set of all YAML syntax that can be emitted non-(answer-to-the-previous-question)ly. I would plan to choose preferences for those parts of syntax per storage, and only expect zero-diff when comparing YAML emitted with the same configuration (but not necessarily the same emitter library). Perhaps constrained-syntax configurations would be useful in many YAML projects. And a question mainly for Kirill: Q: Does PyYaml and/or libyaml have configuration parameters for things like this? Could they be put on the roadmap for new features, once I know what they are and what to call them? Thanks, Jeff [1] Using Git as a versioned data store in Python http://www.newartisans.com/blog_files/git.versioned.data.store.php ------------------------------------------------------------------------- This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/