S-expression symbol library management script

Any recommendation for a good tool (python/C or other script) to extract individual symbols from a library and also replace , remove or add individual symbols in a library , instead of using the Kicad GUI.

The libraries use S-expression format. The idea is to put symbol files under version control and not at the whole library level. We keep our own symbol folder for only the ones used in design so it much less than the whole Kicad repo.

From other discussions it seems there is not a plan to change to individual symbols files due to [1] load/save performance (Still wonder if hat is still an issue since even we have 500 MB/s SATA and 3000~7000 MB/Sec NVME now ) [2] symbols may depend and be derived from other symbols.

I am guessing that a CLI tool to split and merge symbol libraries into individual symbol files (and backward) would be less then a page long for any programming language that has a library for handling S-expressions.

I had a short peek at the user manual of kicad-cli, but it’s capabilities for symbol libraries seem to be limited at the moment. Apparently it can only export an svg version and update libraries from an older version.

https://docs.kicad.org/7.0/en/cli/cli.html

It seems quite sensible to make a feature request on gitlab to extend KiCad-cli with the ability to split and merge symbol libraries.

Yes, Python has nice Search&Replace functions and implementation is not difficult. You can somewhat automate it for Kicad’s files (any file type, individual or multiple files).

I do it often enough that I wrote an App that has a GUI and is demoed in video below (used another users Step File posted issue for this show&tell). The App is specific to Mac (did not bother for Windows/Linux) so, you’re on your own…

The demo shows changing from default Step file to Colored Step file.
The Multiple radio-Btn will cause the change in All files in the selected Folder (including all subsequent embedded files/folders) so, it’s easy to change, for example, a “widget_Rev1” to “widget_Rev2”… etc The GUI has Pull-Down selection for items I typically need to tweak…

There is a plan: Support both "packed" and "unpacked" footprint and symbol libraries (#6917) · Issues · KiCad / KiCad Source Code / kicad · GitLab

Just hasn’t been started on yet.

Many thanks for the responses. I’ll guess then I’ll have to code something. The symbol file format is quite easy to understand.

Have you had a look on KiUtils? It’s basically a parser for KiCad files in python.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.