What method is there to directly execute the entire Klipper Host through a binary file?

Currently, klipper executes klippy code directly on the host side, as Python is an interpreted language. But I would like to ask a question, is there any tool that can compile the entire code into binary files so that there is no need to manage these Python codes online.

Can I ask why would you want to do that? Are you looking at an improvement in code size and/or execution speed (I’m thinking to run on a controller with less memory and processing horsepower)?

Note that Klipper itself is only part of the equation as, at the very least, you’ll also require Moonraker. From there you will connect to Mainsail, Fluidd or Octoprint. Then you have KlipperScreen and the various camera apps as options.

So there’s a certain amount of work involved (not to mention testing) and you would need a very tangible reason for wanting to do it.

1 Like

Yes, I am currently considering improvements in code size and/or execution speed. I won’t consider using Moonraker as an additional product besides Klipper. I will choose to implement a uds client myself to connect and communicate with uds. As for klipperScreen, I don’t need it either. I can implement it using any other cross platform UI framework, such as LVGL, QT, and so on.

I would think that to implement a UDS client with Klipper, you’ve got a lot of work ahead of you. I’m not sure why you would add the step of compiling Klipper into an app when setting up the UDS connection to replace the Moonraker and then providing your own version of KlipperScreen on top of everything would probably run fine as a Python application.

I’m curious what your end plan is for this.

First, I wanted to run Klipper on an embedded Linux platform with relatively small resources, so it was quite heavy for Mooraker and KlipperScreen. I have already implemented something like Mooraker in C. It’s simple, I just need to implement what I want to implement, while Mooraker and KlipperScreen are a big and comprehensive collection. Referring to the recently released Sonic Pad, they did this because the one they have looks a lot like KlipperScreen, but it’s actually a UI they implemented themselves and has nothing to do with KlipperScreen.