Welcome to py5!

py5 is a new version of Processing for Python 3.8+. It makes the Java Processing jars available to the CPython interpreter using JPype. It can do just about everything Processing can do, except with Python instead of Java code.

The goal of py5 is to create a new version of Processing that is integrated into the Python ecosystem. Built into the library are thoughtful choices about how to best get py5 to work with other popular Python libraries such as numpy or Pillow.

Here is the simplest possible example:

def setup():
    size(400, 400)
    rect_mode(CENTER)


def draw():
    rect(random(width), random(height), 10, 10)


run_sketch()

Here is an animated GIF to give you an idea of what that Sketch looks like:

index_example

But don’t settle for an animated GIF! Use the rocket ship icon at the top of this page to run the example on Binder, or better yet, use Live Code with Thebe. Then you will be able to create a Sketch portal and see the running Sketch embedded right in this page.

py5_tools.sketch_portal()

The ability to embed a py5 Sketch in a html page like this is one of the many ways py5 leverages the power of Jupyter Notebooks and is well integrated into the Python ecosystem.

The py5 library has many features but is alpha software. The library and this website are both a work in progress.

To view the actual installed py5 library code, look at the py5 repository. The py5 library code is the output of the meta-programming project py5generator. All py5 development is done through py5generator.