at FOSDEM I discussed with Wayne the idea about an official high level python API for KiCad. From his perspecitive it would be okay as long as it does not requires much attention by the KiCad devs to support it.
As reference, this is the current documentation of the low level api: http://docs.kicad-pcb.org/doxygen-python. This is a 1:1 export of the c++ classes and methodes, which means also including all namechanges,…
My proposal would be building a mostly thin abstraction layer over the low level api to provide:
- a stable interface for plugins
- extensive documentation including example codes (build with sphinx)
- workaround/hacks to fix bugs (like you cannot check if two SWIG objects pointing to the same object)
- pythonic and intuitive interface (properties instead of getter/setter, self explanatory naming, …)
- unittests to detect breaking changes immediatly (mostly smoketests, which can be embedded in the doc itself)
I started building a prototype on GitHub:
Which also exports a documentation based on the code:
In a first step I would like to discuss the idea itself, as well as how the interface to the internals of KiCad should look like. I made some initial coding to test ideas and get the system up and running. I don’t plan to do a full abstraction of the low level api. It would be already very cool to support the most common usecases.