Quality diagrams with PyCirkuit (Orestes Mas) [FOSDEM 2020]


Orestes needs to draw electronic circuits with mathematical formulas and symbols for publications. They have to be publishing quality, there has to be a large library of symbols with the same styles, and the symbols need to be parametrizable. Fonts used in the graphics should be easily changed when changing the font of the entire document.

TikZ exists for LaTeX. This works very well, it has all the required features. The circuit library is provided by cirkuitikz. The problem, though, is that it requires too much absolute coordinates, which makes editing really difficult. There are also some aesthetical issues.

PyCirkuit is a program to help drawing circuits. The circuit is still described in text, but it has a visual output after pressing a button. The circuit text is processed by m4 to create a .pic file. That file is processed by dpic to generate TikZ (next to many other formats). PyCirkuit puts the .tikz file in a template tex file and processes it through latex to get a pdf and from there a png. There’s also a command-line interface to control this pipeline in batch.

It is available in Debian bullseye and PyPI.

There was a nice demonstration - watch the video.