Converting kicad-nightly build to kicad stable
Last updated: Dec 30, 2022
Kicad files are text. Using regular expressions we can convert a kicad-nightly file back to a kicad stable file. Not all features were back-converted and some manual editing needed to be done to the back-converted footprints.
Project code is at: https://github.com/mattoppenheim/convert_kicad_nightly_to_stable
KiCad comes in two flavours - the stable build, which anyone sane uses and the bleeding edge with bugs and experimental new features version, called the nightly build. I used some footprints that were designed using the KiCad-nightly build. So I put up the reference designs using this flaky version of the software.
Quite rightly, a couple of people objected to this. One made an excellent comment on how to back-convert one of the footprints to the KiCad-stable, using a copy-replace command. All KiCad files are text files, so we can easily edit them.
So I found a way to back-convert the KiCad-nightly footprints to the KiCad-stable build using some copy and replace commands with regular expressions. These regular expressions were too complex to use with a simple command like sed so I wrote a Python script to do this. I even wrote some tests for the Python script to get to grip with pytest.
I didn’t have the patience to get all the features back-converted. For instance, I manually deleted arcs and re-drew them.
This scrip is written for the version of the nightly-build that I used, so may or may not work with whatever version of KiCad you use. I’m putting up the code and tests onto GitHub to help anybody else who has the same problem I did.