Skip to main content

Processing for CPython

Project description

py5 is a new version of Processing for Python 3.8+. It makes the Processing Java libraries 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 a simple example of a working py5 Sketch:

import py5

def setup():
    py5.size(200, 200)

def draw():
    py5.square(py5.mouse_x, py5.mouse_y, 10)


If you have Java 11 installed on your computer, you can install py5 using pip:

pip install py5

Detailed installation instructions are available on the documentation website. There are some Special Notes for Mac Users that you should read if you use OSX.

There are currently four basic ways to use py5. They are:

  • module mode, as shown above
  • class mode: create a Python class inherited from py5.Sketch, and support multiple Sketches running at the same time.
  • imported mode: simplified code that omits the py5. prefix. This mode is supported by the py5 Jupyter notebook kernel and the run_sketch command line utility.
  • static mode: functionless code to create static images. This mode is supported by the py5bot Jupyter notebook kernel and the %%py5bot IPython magic.

The py5 library is created by the meta-programming project py5generator. Therefore, the py5 code should not be changed manually. Any issues, etc, should be directed to the py5generator repository.

The py5 documentation website provides basic tutorials and reference documentation. The website is very much a work in progress. The reference documentation is solid but the how-to’s and tutorials need a lot of work. See the py5examples repository for some working examples.

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for py5, version 0.5a2
Filename, size File type Python version Upload date Hashes
Filename, size py5-0.5a2-py3-none-any.whl (11.6 MB) File type Wheel Python version py3 Upload date Hashes View
Filename, size py5-0.5a2.tar.gz (11.6 MB) File type Source Python version None Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring DigiCert DigiCert EV certificate Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page