Manually revert symbol library from 9.99 nightly to 9.0.x

I have accidentally imported a new component into my symbol library using the 9.99 nightly symbol editor. It has saved in the 9.99 format and I need to use it in stable 9.0.x. I also have not made commits for a while, so can’t go back to a backup. Completely my own fault.

I am looking at the difference between 9.99 symbol descriptions in library-name.kicad_sym and 9.0.x. I have changed the (generator_version “9.0”) and (version 20241209) to something matching other 9.0 libraries. KiCad is complaining

Symbol library ‘library-name’ failed to load.
Expecting ‘pin_names, pin_numbers, arc, bezier, circle, pin, polyline, rectangle, or text’ in
‘C:\Users\ … \library-name.kicad_sym’
line 12, offset 4.

Which is perfectly reasonable. On line 12 of the 9.99 symbol library, we have

  (duplicate_pin_numbers_are_jumpers no)

I’m content to find and delete all these instances and see what the next complaint is, but is there a reference in the source about the format change between 9.0.x and a particular nightly so I can try and fix this without bothering the community as frequently?

I’m not a KiCad developer, and can’t help with the source code question, but do have some alternative ideas that may work for you.

You write you do have some backups, but that they are old. You can still use them with a sourcecode diff / merge tool such asmeldmerge Such a tools is useful for finding and comparing the differences between the file formats.

Another option, that may work, is to use meldmerge to merge the new parts from the V9.99 library, back into (a copy of) the old backup. That way you don’t have to mess with the whole file format, but only take out the new symbols (which hopefully have very little differences) and use it to update the old library.

Also, ever since KiCad V6 projects are independent of external libraries. You can create libraries both for symbols and footprints for any parts that are used in any KiCad V6 and later project. (KiCad V5 and earlier are dependent on “external” libraries, and in those days it was common to meticulously maintain project specific libraries for each project that has to be “portable” or “archived”.

@paulvdh thanks for your sage advice. did use meld to start with although mainly to keep track of what I changed. I used a KiCad (rather than personal) library from V9 to see what the main differences were, took a subset of my V9.99 personal library and reverted the visible / complained-about changes. Those few parts then reappeared in V9 symbol editor, so looking promising so far.

I’m on the cusp of a script which should revert the changes for me. Will update here if I succeed.

Sadly this topic is about my embarrassing monorepo library where I have kept all the custom (non-KiCad-provided) parts I have made/accrued over a few years. I look longingly at the database library and html stuff and wish I could decide how I want to split it into a more logical thing.

So the attached script is 99% vibe coded but has got my V9.99 format library (which was autoformatted to V9.99 when I imported and saved a part in a V9.0 library in V9.99 symbol editor - can’t vouch for it working on other scenarios) back into a format V9.0 seems to recognise in the V9.0 symbol editor (as in, they show correctly rendered to my eye when double clicked). I have not verified every part.
v9-99_to_9-0x_symbol_reversion.py (7.4 KB)
The key changes I can determine between V9.99 and V9.0, which need to be reverted.

  • Change the generator_version token value to “9.0”
  • Match the version token date value to something appropriate, like 20241209
  • strip out the duplicate_pin_numbers_are_jumpers token
  • most fiddly: re-nest the hide token inside the effects token