nexusformat / definitions

Definitions of the NeXus Standard File Structure and Contents
https://manual.nexusformat.org/
Other
26 stars 55 forks source link

Nyaml #1282

Closed sanbrock closed 1 year ago

sanbrock commented 1 year ago

Facilitating the human editing of nxdl definitions in yaml. Tool converts from nxdl.xml to nyaml and backwards

sanbrock commented 1 year ago

nyaml2nxdl is now added to support a solution of offering a make option make nxdl as suggested during the Code Camp. This can convert the definitions from the nxdl.xml files (which hold the single source of truth) into nyaml which is easier to edit by humans. The tool can then convert the edited yaml files back to nxdl.xml format for being committed.

phyy-nx commented 1 year ago

This is very cool :) Some comments from code review in code camp:

I needed to run this to get make nyaml to work:

pip install -e .

Could the above be added to the README? Alternatively, could make nymal detect the presence of nyaml2nxdl and recommend the above if not present?

Optional request: if I edit a .yml file generated by nyaml, could make nymal detect the change and do the reverse conversion automatically?

Finally, I ran these steps to attempt a "round trip":

  1. make nyaml
  2. cd applications/nyaml
  3. nyaml2nxdl --input-file NXmx.yaml
  4. diff -uBb ../NXmx.nxdl.xml NXmx.nxdl.xml

The white space changes are expected, no worries. This seems like it could trip up other software though:

-                            group_names: ["DET", "DTL", "DTR", "DLL", "DLR"]
+                       group_names: ["DET", "DTL", "DTR", "DLL", "DLR"]

Seems to have issues translated quotes inside a doc string.

sanbrock commented 1 year ago

new PR is under preparation for conserving micro-credits

sanbrock commented 1 year ago

PR #1303 is replacing this one