Gramps XML version format

The Gramps XML version (1.7.2 as of Gramps 6.0.0) looks like it follows SemVer. Is that indeed the case?

No. It has a similar structure, but the use of the individual elements is different.

Ah, glad I asked. Is the format documented somewhere?

Basically, somebody reported Betty does not work with Gramps XML 1.7.2 · Issue #2560 · bartfeenstra/betty · GitHub and I want to solve this by parsing the version from the XML and checking if it’s compatible with 1.7.1 (the version Betty’s Gramps XML loading code was written against).

Change in on eventref (Person, Family) with a citation support.

2 Likes

Thanks for reminding us of this. I have updated the Gramps XML page in the wiki.

Thanks! As long as those are optional additions it should be BC with 1.7.1, but it’s helpful for me to be aware of these changes :slight_smile:

@Nick-Hall What logic would I use to determine if two XML versions are compatible? Regular Python version comparison if not SemVer?

1 Like

It looks like we use the “X.Y.Z” format for versions. If only new features are added the we increment Z. If features are removed we increment Y.

1 Like

But they are intertwined a bit too, correct? So if you increment Y (removing features), then Z resets to zero but can still include new features.

(Otherwise, the Y and Z seem to be reversed.)

Ta. Does that mean the 1 prefix is considered static and without meaning?

Yes. The version number increases in the usual way.

Unfortunately there are inconsistencies. I think that there has been a tendency to link the XML version to the Gramps version, so Y might have been incremented when not strictly necessary. There were also cases where the XML export was reporting the wrong version. This is why some Gramps versions have more than one XML version.

I don’t see the leading “1” changing unless we make some major change to the format.

2 Likes

Okay, so basically:

  • if X is increased, Y and Z become 0
  • if Y is increased, Z becomes 0
  • X.Y.Z+n is compatible with X.Y.Z
  • X.Y+n.x is incompatible with X.Y.x
1 Like

I’m not sure that there isn’t another level of compatibility.

I exported a 1.7.2 with Gramps 6.0.1 but Gramps 5.2.2 would not import that file. Even after manually changing the header to 1.7.1, the Gramps 6.0.1 version in the header caused it to refuse attempting to load.

The XML had only 2 objects (a Note and a Media with a URL path) And that data has been supported since at least 2015.

So if you are going to use the Gramps engine for Betty and its Importer/Exporter plugins, then make you should see if that is a compatibility limitation that you can override?https://gramps.discourse.group/t/re-develop-download-media-addon-for-gramps-6-0/7492

Interesting!

Betty will continue parsing Gramps XML itself until Allow Gramps' core to be imported without requiring GObject by bartfeenstra · Pull Request #2016 · gramps-project/gramps · GitHub is fixed, so I’ll have to code our own solution to handle XML versions for now.