New py5 Release: 0.10.10a7
Version 0.10.10a7 of py5 is now live. What’s new?
Upgraded py5_tools Module
We have upgraded the py5_tools module so you can run code with it from the command line:
$ python -m py5_tools -h
Usage: python -m py5_tools <command> [args...]
Available commands:
cmd
translate-imported2module
translate-module2imported
translate-processingpy2imported
utils
run-sketch
live-coding
install-jdkThe last command line tool you is install-jdk, which is a new tool that helps you install the Java Development Kit (JDK) on your system. This will simplify things for beginners who are having setup issues.
$ python -m py5_tools install-jdk -h
usage: __main__.py [-h] [-j JAVA_VERSION] [--jre]
Install Java Development Kit
options:
-h, --help show this help message and exit
-j JAVA_VERSION, --java-version JAVA_VERSION
Java Version (must be 17 or greater, defaults to 21)
--jre Install Java Runtime Environment (JRE) instead of Java Development Kit (JDK)The command line tool is also available through the more direct route with the py5-install-jdk command.
$ py5-install-jdk -j 26
Installing Java Development Kit version 26...
Java Development Kit version 26 installed to /home/jim/.jdk/jdk-26+35While testing this new feature, Alexandre Villares and I found a bug in py5’s code that starts the JVM. The issue was related to non-ASCII characters. It is likely that this has been causing us support problems for some time. We are both very happy that this is now fixed!
Context Manager Fixes and Improvements
I repaired the type hints for all methods with associated context managers such as begin_shape() or push_matrix(). Also, the begin_record() and begin_raw() methods now correctly return Py5Graphics objects when there is one parameter.
Trimesh Object Conversion
I found a bug in the Trimesh object conversion due to the facets functionality added in the previous release. There are also now flip_u and flip_v keyword arguments to adjust for different UV coordinates systems. From the Trimesh integration page:
def setup():
global strawberry
py5.size(300, 500, py5.P3D)
# the `flip_v=True` kwarg is necessary for this texture to appear correctly
strawberry = py5.convert_shape(strawberry_scene, flip_v=True)
assert isinstance(strawberry, py5.Py5Shape)
strawberry.scale(50)
strawberry.rotate_z(-py5.radians(90))Other Bug Fixes and Small Improvements
Python supports something called “entry points” that can be used by a Python library to make other Python libraries aware of their presence in an environment. This allows other Python libraries to add their own jars to the classpath before JVM starts up, which can be useful when using py5 with other Java-based libraries.
I also modernized the organization of py5’s source code, moving away from the previous “flat” directory structure.
And finally, I improved the Live Coding functionality to work better with uv.
Sponsor py5coding on GitHub
Like py5? Want to help support further py5 development? Consider sponsoring py5 on GitHub.
I started working on py5 almost six years ago when the pandemic lockdown started as a way to manage my anxiety about the situation. Since then, py5 has grown into a full-featured tool for creative coding that is used all around the world. I’m grateful for the support of everyone I’ve met who helped py5 grow into the useful library that it is today. I love working on this, but it does take a lot of time and is very much like a part time job for me.
I’m not going to pressure anyone into becoming a sponsor and I do ask that if you are struggling financially for any reason that you don’t sponsor py5. But if you are able to sponsor py5, please consider doing so. Your sponsorship will help me continue to work on py5 and make it a better tool for everyone to use!
And if you don’t want to sponsor py5, that’s totally fine too. How about a GitHub star instead? The py5 and py5generator repositories could use a star from you!
What’s Ahead
Next I’d really like to do a release of the py5’s Thonny plugin. An update is overdue!