Haiku-PyAPI: Python bindings for the Haiku API

Depends on who’s going to be using it. If you see someone picking this up in the first week of the Haiku experience, then it has to support the official release (even if it’s named “beta”, it’s what we have.) If it’s more a die-hard fringe, maybe not as important.

(I don’t know anything you don’t know, but quite a while can elapse between releases. I wouldn’t hold my breath.)

2 Likes

The question is, when is R1/Beta5 coming out?
If it is coming in late 2024 or something, then we should try to support beta4.
But if beta5 is coming soon, we’ll just wait until then to support the latest beta.

Yes, it certainly would be useful to know when the next beta will be released.

Yes, it should run on R1/B4, though I haven’t tested it. The question is just whether to make the code a little messier to support compiling on it.

The more “official” version is Beta4. A new beta may take a long to be released, so it would be better if the software is tested to run in the Beta4. The nightlies, as explained, are test releases and can break things any time.

Do the buildmasters run on beta4 or the nightlies?

The buildmasters run Beta4. To be more precise: haiku-r1~beta4_hrev56578_87-1 at the moment.

Ok, in that case we’ll probably have to support compiling on R1/B4

1 Like

Yes, the entire OS is in beta, which means mostly feature complete but with bugs.
The beta releases themselves get updates but only minor bugfixes, no big compatibility breaking changes.

The nightlies on the other have have no compatibility promises.

28 posts were split to a new topic: Haiku-PyAPI app: Feed aggregator BGator2 (name may change)

Haiku-PyAPI 0.2 has been released :tada:. In 0.1, pretty much the app kit and a little bit of the interface kit were available. Now, a good many other kits are available.

Here are some apps that you can run with it:

Special thanks to @TmTFx and @coolcoder613 for their work!

16 Likes

Hello,

I’m investigating if PyCharm + python + PyAPI is easy to use.

For the moment, I’ve got a quick example working in PyCharm : however is there any documentation regarding how to use the PyAPI ?

Trying to add the view to the window, I’ve got the below error :

2 Likes

The documentation is mainly the C++ docs and code that has been written with it. For your particular problem, that should be self.AddChild(view, None). I have just added more links to example projects in the Haiku-PyAPI README.

3 Likes

Haiku-PyAPI 0.3 is here :tada:. Now, virtually all of Haiku’s API is supported. However, If you make an application, I wouldn’t be surprised if you run into a bug or two. And definitely, there are plenty of memory leaks left to fix!

Thanks to @coolcoder613 for spending the time to make the release and @TmTFx for adding support for the rest of the kits!

15 Likes

Great to see new applications, but how to use it?
Python apps with Haiku style? Is it? Nice to see some tutorials soon.

Yes, I was thinking to talk about it soon on Haiku Insider, even if the ressources on that topic are limited today.

You can check for instance the example projects in the README : GitHub - coolcoder613eb/Haiku-PyAPI: Python bindings for the Haiku API

3 Likes

Yes, the API is used almost an exact copy of Haiku’s API. I improved the small example program in the repository. Hopefully that gives a good idea of how to use it.

2 Likes

Example of usage of Python+HaikuAPI with bash interaction :slight_smile:

3 Likes

That does seem to be duplicating the functionality of alert:wink:

Yes this is to showcase what can be done using just Python with the API.

Version 0.4 of Haiku-PyAPI has been released! @TmTFx did most of the work. I answered questions and made the release.

This release has

  • Built-in documentation for most/all functions in the App kit. Just use the Python help function!
  • Bug fixes. Surprise, surprise, Haiku-PyAPI still has plenty of bugs to be fixed.
  • The beginnings of Sphinx documentation. Currently, it’s not viewable on the web anywhere.
  • Versions of functions that are more natural to use in Python. We’re keeping the ones that stick as closely to the C++ API as possible, but there are also Pythonic variants available. For example, instead of doing status = message.FindString("key", outputString), you can do status, outputString = message.FindString("key").

We also have some applications that are made with Haiku-PyAPI on HaikuDepot. @TmTFx made all of them!

  • HaiQR – Generates QR codes.
  • FeedGator – RSS feed reader. The updated version hasn’t been released yet, so you’ll need to wait a bit for this one.
  • HaiPO – Edit PO files. Currently doesn’t work out of the box.

Enjoy!

8 Likes