Haiku API bindings for Python

My decision to go with Python has a lot to do with two inter related matters:

  • free time: shortage of free time that needs to be shared
  • productivity: increase productivity with the least effort

So I picked python mostly because Godot uses a python-like scripting language, Python language seemed easy enough, python integrates quite well with Gnome-Builder, and don’t have enough free time to learn C# for this, C++ for that, C for whatever other thing, and who knows for the sake of it. I tried to go with C# in Godot, but had some stability issues, so I’ll stick with GDScript for now.

Img. 1 – Healynet files. Need to click on the “f2fd4a5a04” to go to download site
Thanks to BlueSky for the tip

So only one leg left to add to the table, and that was the python availability on Haiku. Not sure right now who was the one who pointed out a website where some python bindings were available for Haiku, at Healynet, then I went there added the repository to the Haiku package manager and nothing. No bindings available, no way to get anything, nothing. Stuck there.

Asking at the Haiku forum, BlueSky pointed out the link to the download page where the whole package can be downloaded as a .ZIP file (check Img.1).

Img. 2 – Download page. ZIP archive link at top, that is the link I used

Once downloaded, and extracted we get all the files as shown in Img. 3:

Img. 3 – Files in Tracker window

Rest goes through the terminal. Once extracted, open a terminal in the Haiku API Bindigs folder and, in order to install the python bindings, just need to type ./build_python.sh in the terminal and wait for it to finish:

Img. 4 – Installing the Python API bindings

Once the installation is complete, we can test if it went fine with the provided examples:

Img. 5 – Python examples provided with the API Bindings

Just open a terminal there and fire up an example (ClickMe.py in the next image):

Img. 6 – ClickMe.py example running

We should be aware that these bindings only work with Python 2.7. Haiku provides Python 2.7 as well as Python 3.7, so I tried both:

Img. 7 – Python API bindings not working with python 3

The bindings don’t work with Python 3, at least for now. Maybe it’s a simple issue so later when I have more free time will dig into it and check if I can find why it did not work with Python 3.

Until then, at least we can have Python Bindings for the Haiku API, and code software for Haiku using Python and native interface, no Qt, no GTK…

This is good news!!…