New py5 Release: 0.10.4a2

I'm happy to announce the release of py5 version 0.10.4a2. This the fourth and final release of 2024.

Platform Issues: macOS and Windows

The main purpose of this release is to address a long-standing issue on macOS. The macOS issue was opened by me in issue #5 and has been a thorn in my side ever since. Recently a member of our py5 community, wissme, reported that my hack to alleviate the symptoms of the issue wasn't working on Apple Silicon computers. This prompted me to revisit the situation, and happily I was able to gain new insights into how to properly address py5's platform specific challenges. This resulted in a new approach to window focusing that not only fixes the macOS issue, but also improves code quality on macOS and Windows.

There are some changes you should be aware of:

  • On macOS, when you import py5, you will see the py5 logo immediately appear in the dock. This is a side effect of the new approach to window focusing. When this happens, it will also defocus whatever window (ie terminal, Jupyter Notebook) you were using to import py5. This is a minor annoyance, but it's a small price to pay for the improved code quality and the fix for the macOS issue. Most significantly, your Sketch window will no longer appear behind other windows or have trouble with keyboard events.

  • For Windows users, there is a new dependency on the Python library pywin32. This library is widely used and is already required by Jupyter. Here, the library is used to focus the Sketch window on that OS.

But There's a Catch...

Although this release is a big step forward for py5 on macOS machines, there is one problem.

My old MacBook Pro laptop, with an Intel i7 CPU, runs macOS 12.7.6 (Monterey) and cannot be upgraded to a newer macOS version. For reasons I cannot fathom, py5 has an odd limitation when run in a Jupyter Notebook on this machine. If the first Sketch to be executed uses the default (JAVA2D) renderer, later executing a Sketch that uses an OpenGL renderer will cause the IPython kernel to crash. Bottom line, if I want to use py5 with an OpenGL renderer anywhere in the notebook, the first Sketch I run must also use OpenGL.

I don't have this problem on my newer 2020 MacBook Pro with an M1 chip. Everything worked just fine with macOS 14.7.2 (Sonoma). I upgraded it to macOS 15.2 (Sequoia), and it works fine there too.

This is an obscure problem that will likely affect very few users. And the benefit of this code change is so significant I was not going to leave it out just to avoid this obscure bug.

I don't know if this is because of something different with the Intel CPU or if it is because of the old (and no longer supported) macOS version 12.7.6. Hopefully others from the py5 community can provide feedback here so I can better understand what is going on.

To prevent a crash on machines that are potentially vulnerable to this problem, py5 will detect the sequence of events that would lead to a crash and will instead output a helpful message and throw an exception.

However, I would like some help from the py5 community to better understand the problem. If you have a macOS machine with either an Intel CPU or an older version of macOS, please head over to the GitHub issue I created specifically to track this. There you will find instructions for a quick test you can do to help me figure out which machines are vulnerable to this problem and which are not.

JPype Version Pin

The JPype dependency is now pinned to version 1.5.0. If you install this release to replace a previous py5 release, you may already have JPype 1.5.1 installed. Installing this version of py5 will downgrade JPype to 1.5.0. JPype version 1.5.1 has a problem that makes it harder for some users to get py5 up and running. The next version of JPype, 1.5.2, will fix this. I will update the py5 dependency to 1.5.2 when it is released.

Closed Issues

Here are the closed issues:

  • #5 fixed a long term shortcoming on macOS and improving code quality on macOS and Windows

  • #549 new intercept_escape() method to assist users who want to prevent the ESC key from closing the Sketch

  • #564 fixed a new complication related to #5 that occurs on Apple Silicon

And one more closed issue in Processing:

  • #791 fix for Processing PShape bug involving shapes with multiple contours

Processing Library

Processing release candidate 4.3.2 is now available, and I am pleased to report it contains my PR for #791.

All of this happened recently and I haven't had time to test py5 using this new Processing release. Therefore, py5 is still using the Processing fork I used for the previous few releases. However, this might be the last py5 release to do so. Once Processing does a proper release (not a release candidate) with my PR, py5 will switch back to using the official Processing core.jar file.

What's Ahead

It's almost the end of 2024. What's in store for py5 in 2025?

In the short term, more bug fixes. And I'm also eager to get Processing back to a maintained core.jar file.

Long term, I want to get back to writing unit tests. I also want to set up GitHub Actions to run the unit tests automatically.

Once both of those things happen, I will stop designating py5 as "alpha" software (this is the 'a' in the version number 0.10.4a2). The library is clearly stable and robust, but I want to have the unit tests in place before I make that official.

As for new features, there are lots of ideas bouncing around in my head. I'm not sure which ones I will work on first and won't make a prediction here. And know that I'm always open to suggestions, so if you have an idea for a new feature, please let me know! Many of the best py5 features have emerged from discussions with users over on GitHub!

Comments