Skip to main content

Downloads License Version Slack build-tests downloads-month

p5 is a Python library that provides high level drawing functionality to help you quickly create simulations and interactive art using Python. It combines the core ideas of Processing — learning to code in a visual context — with Python’s readability to make programming more accessible to beginners, educators, and artists.

To report a bug / make a feature request use the issues page in this repository. You can also use the discourse platform to ask/discuss anything related to p5py.

Example

https://github.com/p5py/p5/raw/develop/docs/_static/readme.gif

p5 programs are called “sketches” and are run as any other Python program. The sketch above, for instance, draws a circle at the mouse location that gets a random reddish color when the mouse is pressed and is white otherwise; the size of the circle is chosen randomly. The Python code for the sketch looks like:

from p5 import *

def setup():
    size(640, 360)
    no_stroke()
    background(204)

def draw():
    if mouse_is_pressed:
        fill(random_uniform(255), random_uniform(127), random_uniform(51), 127)
    else:
        fill(255, 15)

    circle_size = random_uniform(low=10, high=80)

    circle((mouse_x, mouse_y), circle_size)

def key_pressed(event):
    background(204)

# p5 supports different backends to render sketches,
# "vispy" for both 2D and 3D sketches & "skia" for 2D sketches
# use "skia" for better 2D experience
# Default renderer is set to "vispy"
run(renderer="vispy") # "skia" is still in beta

Documentation

The p5py documentation can be found here p5 documentation

Installation

Take a look at the installation steps here in the p5 installation page

Contributing

We welcome contributions from anyone, even if you are new to open source. You can start by fixing the existing issues in p5py. In case you need any help or support from the p5py development community, you can join our slack group.

License

p5 is licensed under the GPLv3. See LICENSE for more details. p5 also includes the following components from other open source projects:

All licenses for these external components are available in the LICENSES folder.

Metadata

Release files for p5 0.9.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for p5 0.9.0
File Size Uploaded Provenance Actions
p5-0.9.0.tar.gz 113.7 kB Without provenance Details for p5-0.9.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for p5 0.9.0
File Interpreter ABI Platform Actions
p5-0.9.0-py3-none-any.whl Python 3 none any Details for p5-0.9.0-py3-none-any.whl

Total release size: 259.7 kB

Release files / p5-0.9.0.tar.gz

Download URL p5-0.9.0.tar.gz
Size 113.7 kB
Tags Source
SHA-256 checksum
How to use checksums
ca72d6e0cc5075f636e114e6167bc02a75745c7e92741ea1d572f7c7f9774947
BLAKE2b-256 checksum
How to use checksums
6cb06d16c30ca5b779b09fc97dc3140d76d6d78208c2661695b8eb386b3fe586
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.3

Release files / p5-0.9.0-py3-none-any.whl

Download URL p5-0.9.0-py3-none-any.whl
Size 146.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
73714871f13dbe323c6d39d600160fdc37d49e8bc781652ee61158be6688d026
BLAKE2b-256 checksum
How to use checksums
122b66178e1e9e668721a738c8e6c23fba09daaadb0b57eb49f2b804ffee2d5e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.3

Security for p5 0.9.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page