Support new KiCad library format

With the upcoming KiCad 6, a new file format is used for libraries.

Has any work been started to support it?
If not, any particular input as to how to add support for it? I’ve seen the tools/ plugin… I might give it a try.

Yes, tools/ would be the place to support the new library format. The library reader function would need to scan a library file and determine which format was being read as V6 and V5 will co-exist for a while.

Has anybody released a Python library for parsing the new file formats?

To answer my own question, an S-expression parser for the new KiCad library format can be found here. That’s a small step towards supporting the new libraries.

I actually played with sexpdata which is a library to read s-expression.
Not necessarily fond of yet another dependency, but let’s just get it working, can always refactor later.

I played around a bit with the parse_sexp() and an EESCHEMA file. It creates a nested set of lists that would need some processing to make it more useful. I’ll take a look at sexpdata and see if that’s more feature-complete.

It’s the same. It doesn’t really matter which one you use. And you’re right, since kicad uses the one you showed, it might be the best way forward.
I have a quick n’dirty ™ parsing working, looking at how to do it clean within now.

One way forward might be to copy into a file in the tools directory. Then that would be activated if you set the tool to KICAD6. Then you could make your changes in instead of trying to handle both kicad formats at once.

Also, I created a branch called kicad_v6. If you do any work on this, make PRs against that. Thanks!

Good idea, might end up being simpler :+1:
I’ll try to get a first version by tonight :crossed_fingers:

Ok tonight was optimistic :wink:
I’ll get back to you later this week I need to find some time to finish.