Py5 presentation at PyCon 2024

Here is the presentation I delivered at PyCon 2024, titled Creative Coding with py5, the Python version of Processing.

Please watch the video and give it a thumbs up if you could!

I was so grateful to share py5 with the Python community.

9 Likes

Nice presentation. What are the steps necessary to allow us to use py5 in the Processing editor?

Hi @svan !

py5 cannot work in the Processing editor (PDE). It does work in any other editor that works with other Python libraries. I use VSCode, but if you prefer a beginner friendly editor, I recommend Thonny. There is a py5 plugin for Thonny that you can use that gives a PDE-like experience. You can read more about it here:

2 Likes

Do you have datatype description stub files for it?

Are you asking about Python typehints? If so, they are built into the library.

1 Like

Just out of curiosity, what would it take to make py5 work in the PDE?

Good question! There are some technical and design challenges that would have to be addressed.

First, py5 does require a JRE. Normally that’s hurdle, but in the case of the PDE, it is taken care of because the PDE ships with a JRE already.

Next, py5 requires a python environment. It isn’t just the py5 library, there needs to be a python environment with a python interpreter and other dependent libraries. This part would be a challenge to address but it is solvable. My personal preference is to use Anaconda to create and manage the environment. One can also install Python using other means and create a virtual environment. The environment is kind of like a self-contained world where you can install Python packages and keep everything separate from other Python environments.

Perhaps the PDE, when installing a py5 “mode”, could download and setup these things for a user. The python executable would be platform specific.

To be useful, the Python environment created to run py5 should be accessible to the user so they can install other Python libraries. Some like numpy or matplotlib or shapely are so useful to py5 that they would be installed by default, but there are always going to be other libraries that a user would want to use that they need to add later. Right now the Thonny editor has a package manager that does this work for the user. The PDE would probably need something similar.

Next, how to get py5 to work in the PDE. I imagine you could recycle some code from processing.py for getting Python syntax working in the editor. Getting a sketch to run would involve making a system call to a command line tool provided with py5.

There could be other approaches that involve the Jupyter Notebook kernel created for py5.

All of this would have to be done in a way that is accessible to beginners. @villares would have some good ideas here for how to do this.

4 Likes