Posts about python

New py5 Release: 0.9.1a1

We are moving back to py5's previous release frequency of a release every 2-3 months. This is minor release with one important feature to support Thonny users, as well as a handful of bug fixes and other improvements.

Imported Mode Code Importing feature

Python projects with moderate to large amounts of code will be typically split into multiple files that will be imported from from one file to another. However, due to the way py5's Imported Mode works, this couldn't be done with py5 Imported Mode code. This new feature changes that, supporting the ability to import Imported Mode code from one file to another. How to do this is described in more detail in the documentation page Importing Imported Mode Code. In addition, the documentation also describes General py5 Importing Guidelines for writing importable py5 code in that supports all of py5's programming modes.

Other Changes

Read more…

New py5 Release: 0.9.0a0

It has been over 5 months since the last py5 release, which is a long time compared to previous releases. The main reason for this is the time and effort that went into completing two new features that I am very excited about: Hybrid Programming and Processing Mode. More on that in a moment.

This is a major release with important new features and many bug fixes. Thanks as always to Alexandre Villares (@villares@ciberlandia.pt) for finding many of the now fixed bugs and for helpful design discussions. Thanks to @AsadNizami for two pull requests, thanks to @dmorenog01 for a pull request, and thanks to @marziabil for inspiring the enhancement behind issue #247.

Hybrid Programming & Processing Mode

Hybrid Programming refers to the ability to add your own Java (Processing) code to py5. Think of it as a way to add custom Processing extensions to py5. Hybrid Programming is useful for boosting py5's performance and making Java libraries more accessible to py5.

Processing Mode is a completely new way to use py5. This feature is built for the Java Processing users. It allows py5 to function as a bridge, connecting the Java code users write for Processing sketches to the Python ecosystem. Processing Mode gives Processing users a new method callPython(), which gives everyone an easy way to call Python code from Processing.

Both Hybrid Programming and Processing Mode are documented extensively on the py5 documentation website. There's also a GitHub repo with example code. As these are new features, the documentation and example code will grow as questions come up and issues are raised. Stay tuned!

I'm thrilled to finally be able to share these new features with the py5 community. I hope you find them useful and easy to use. I'm looking forward to seeing what people do with them.

On the subject of documentation, there is now a page explaining how py5 actually works. I've wanted to write this documentation for a long time. This information will be useful for advanced coders who want to better understand how py5 works and for developers who want to contribute to py5. More documentation does need to be written about py5's internals, but this is a good start. The documentation will evolve as readers ask questions and I make improvements to the text.

Read more…

New py5 Release: 0.8.3a1

This is a minor release with a handful of bug fixes and small enhancements. Most of the bug fixes are small improvements to the documentation or error messages. Thanks again to Alexandre Villares for raising the majority of the now fixed bugs.

Enhancements

  • New methods for saving and loading data. The new methods are load_strings(), save_strings(), load_bytes(), save_bytes(), load_pickle(), and save_pickle()

  • New join_thread() method

Read more…

New py5 Release: 0.8.2a1

This is a minor release with a handful of bug fixes. Some of the bugs were serious issues affecting Thonny users, such as # 117 found by Alexandre Villares. Many thanks to him for uncovering these problems. The other changes were small improvements to the functionality or reference documentation.

Since some of the issues were serious problems affecting Thonny users, I didn't want to make anyone wait to get the improved version.

Pull Requests

There was one pull request from Alexandre Villares to improve py5's reference documentation. Thank you!

Read more…

New py5 Release: 0.8.1a1

This is a minor release with many bug fixes and several new features.

Announcements

The big announcement is that py5 is now receiving direct support from the Processing Foundation to fund the creation of beginner tutorials. This is a part of the Processing Foundation's GSoC 2022 program. Our talented contributor, Zelle Marcovicci, is doing an amazing job writing tutorials. I am so deeply grateful for all of this.

We can now affirmatively state that py5 works on Apple Silicon (macOS-aarch64) machines. Hooray!

This release uses the latest Processing 4.0b9 jar files.

Pull Requests

There were two pull requests from Alexandre Villares to improve py5's translator utilities for converting code between processing.py, py5 imported mode, and py5 module mode.

New Features

This release has a handful of new features, almost all of which are the product of conversations with members of the py5 community.

Read more…

New py5 Release: 0.8.0a0

This is a major release with some significant changes! I am very excited for the progress that has been made since the last release.

New Features

Event Classes

There are new Py5KeyboardEvent and Py5MouseEvent classes. These can be passed to user defined event functions such as mouse_clicked() or key_pressed(). Below is a simple example.

Read more…

New py5 Release: 0.7.2a0

The previous release had some unexpected and urgent OSX problems. This release fixes them, and in addition, expands the py5 functionality available on OSX. This is the first py5 release that can run py5 Sketches with the generic Python interpreter and not through a Jupyter notebook.

The fix involved applying some things I learned from studying jpype's source code and previously applied to the run_sketch command line utility used by the Thonny plugin.

I've been searching for a way to get py5 to work with the generic Python interpreter for a long time. When I sat down to address this latest bug, everything came together in the right way and it just worked. I'm thrilled.

There are still a few more outstanding OSX related issues for me to solve, and that's before considering the Apple Silicon can of worms. All of these things will be addressed over the next few releases. There is a clear path between this release and cross-platform feature parity.

Bug fixes:

Questions:

Maybe this next release works on Apple Silicon (macOS-aarch64) machines? Please test and provide feedback.

What's Ahead:

  • Unit tests!

  • More OSX improvements!

New py5 Release: 0.7.1a6

Another big release, 2 months after the previous release.

Here are the new features in this release:

  • Update Processing jars to version 4.0b6. This means py5 now supports the new features in that release, including the new commands for controlling the Sketch window such as window_move() and window_title().

  • Improvements to py5 to enable packaging with pyinstaller. In the near future I will add documentation to the py5 website explaining how to do this. If you can't wait that long, have a look at this gist for a working example. That example has room for improvement, and will be improved before the documentation is finalized.

  • The typehints have been updated to conform to PEP 585. Also, the numpy typing package nptyping has been removed in favor of using the numpy typehint features introduced in versions 1.20 and 1.21. This version of py5 now requires numpy>=1.21, but that shouldn't be a problem for anyone because that version has been out for almost a year now and most likely you have version 1.22 installed already.

  • The run_sketch command line tool now accepts command line arguments that will get passed to Processing. Among other things, this will allow the Thonny plugin to set the window position. (#60).

  • As previously stated, this release now requires Java 17.

Bug fixes:

Questions:

I'd like someone with an Apple Silicon (macOS-aarch64) machine to test py5 and tell me if it works. I'm specifically curious about the P2D and P3D renderers. I don't think it will work but I want to know what happens. I don't have access to such a machine to do the test myself.

What's Ahead:

  • Unit tests! Not having them is costing me too much time.

  • OSX improvements! I have new ideas and believe it is time to revisit the OSX limitations.

New py5 Release: 0.7.0a0

A another big release with two new features!

But before getting into that, an important announcement. This is the last version of py5 that will run on Java 11. The next version of py5, probably (hopefully) available in February, will require Java 17. This is changing because Processing 4 now requires Java 17. I am delaying py5's upgrade to Java 17 to give others a chance to adapt their code. This version will work just fine with Java 17, but does not require it.

And back to the release. What's new:

  • Reworked noise functionality. The Python noise library is no longer used to generate noise; the library has been removed as dependency. Instead, py5 uses the OpenSimplex noise algorithm and Processing's noise algorithm. The OpenSimplex algorithm is provided by KdotJPG's OpenSimplex2S implementation. Both support noise generation with numpy arrays as parameters. Read the documentation to learn more.

  • New Py5Vector class. This new feature was a lot of work and incorporates the design ideas of many people in the py5 community. Read the documentation to learn what you can do with this class.

Here's an animated GIF I created with py5 and the new Py5Vector class. The example code is available as a gist.

/images/py5/tesseract.gif

Bug Fixes:

  • #50

  • #52

  • Other small bugs I found and fixed along the way

What's Ahead:

  • Move required Java version from 11 to 17.

  • Many improvements to type hints. The Python nptyping library will be removed and numpy (version >=1.20) will be used instead.