Just released: Leidokos-Python

Leidokos-Python

Today I am very happy to release Leidokos-Python, a Python scriptable Kaleidoscope keyboard simulator.

What it can do for you

Leidokos-Python can greatly help you while developing new firmware plugins and features. It can also support you while debugging existing firmware code or as a powerful tool for regression testing of existing or newly developed firmware parts.

Run tests with exact timing of key-actions

The simulator enables to define precise test runs with exact timing of key-actions. You can loop those while optimizing or debugging the firmware code until everything works as you imagine.

More transparency for your keyboard

The provided Python API allows to observe the firmware’s runtime behavior in terms of USB HID reports, LED states and the keyboard firmware’s internal state. Most of Kaleidoscope core functionality and state is exported as Python code.

Visualization

You want to find out what keymap is currently active? Or, would you like to check the state of the keyboard’s LEDs? A single Python command allows you to visualize the keyboard’s LED colors and the currently active keymap.

Test driven development

Leidokos-Python encourages test driven development. The tiring development loop change-compile-upload-test-frown can be shortened to change-test-smile. Any tests that you generate during development can later easily be converted to become a valuable basis for future regression testing.

Build only changed code

As you might know, Arduino-IDE and Kaleidoscope-Builder both always build the overall firmware, even if only individual files changed. By relying on Leidokos-CMake, Leidokos-Python carefully builds only those files of your firmware that actually changed. This saves a lot of time that can be used more productively.

Printf-debugging is so yesterday

Run the overall Python simulator in your favorite debugger. Debug the firmware just as if it was an ordinary host program - segmentation faults included.

A powerful testing API

Leidokos-Python’s API comes with a large number of predefined assertion classes. They make it easy to define test sets. By using them, you will formulate conditions that must be met by a sequence of USB HID reports or you will assert correct runtime behavior. New assertion classes can easily be added, thereby being inspired by the numerous existing assertion classes.

Regression testing

Leidokos-Python inter-operates with Leidokos-Testing. This regression testing system, which is about to be released soon can already be seen in action as a regression testing tool for all sub-projects of CapeLeidokos.

Write plugins that are ready to use when your M01 arrives

I am waiting now for more than half a year on my M01. Good things can take time…

In the meantime I am porting all the stuff I am using on my other programmable keyboards to Kaleidoscope. This naturally requires a lot of debugging and testing. Leidokos-Python helps me a lot during this process. I am positive that verything will be ready when the keyboard is finally going to arrive.

Leidokos-Python supports to development and testing of plugins on virtual hardware. If you do not use too exotic functionality, you can run a new plugin that you developed with the help of Leidokos-Python, directly on the physical hardware. Of course, you must build it for the target platform first, using Leidokos-CMake or the Arduino IDE .
Small changes to the plugin code might only be necessary when you accidentally happened to use functions that are not supported by the target platform. Apart from that you should be fine.

Supported platforms

Currently Leidokos-Python is tested and supported for GNU/Linux and MacOS.

I am not a Windows user. Before I can start supporting Windows, Appveyor based CI testing must be enabled for the project. As I am currently lacking time to add CI testing, windows is not officially supported.
This does, however, not mean that I won’t help you with getting Leidokos-Python to work on Windows. All 3rd party software that is required (Python, boost, CMake) is also available on Windows.
Volunteers, one pace forwards!

6 Likes

That’s awesome. I’m most interested in the visualization part. Referring to the sketch file is tedious, especially when 5 different layers are used.

Am eagerly awaiting the Windows port.

1 Like

This looks great. I can certainly see this being handy for a lot of people!

I will see what I can do with the Windows port.

1 Like