Skip to main content
Warning: You are using the test version of PyPI. This is a pre-production deployment of Warehouse. Changes made here affect the production instance of TestPyPI (
Help us improve Python packaging - Donate today!

Creative coding in Python

Project Description


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.


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)

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

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

    circle((mouse_x, mouse_y), circle_size)

def key_pressed(event):



p5 requires Python 3 to run. Once you have the correct version of Python installed, you can run:

$ pip install numpy
$ pip install p5 --user

to install p5.

Features Roadmap

Our end goal is to create a Processing-like API for Python. However, instead of being a strict port of the original Processing API, we will also try to extend it and use Python’s goodness whenever we can.

For now, though, we plan to focus on the following features:

  1. Support most 2D drawing primitives and related utility functions from the Processing API (as of the latest release, this is almost done).
  2. Support other parts of the Processing API: images, fonts, etc.
  3. Port relevant tutorials and reference material from Processing’s documentation.
  4. Support live coding of sketches in the Python REPL (here’s a screencast from an earlier prototype).


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.

Release History

Release History

This version
History Node


Download Files

Download Files

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

File Name & Checksum SHA256 Checksum Help Version File Type Upload Date
p5-0.3.0a2-py3.5.egg (111.0 kB) Copy SHA256 Checksum SHA256 3.5 Egg Aug 20, 2017
p5-0.3.0a2-py3.6.egg (109.4 kB) Copy SHA256 Checksum SHA256 3.6 Egg Aug 20, 2017
p5-0.3.0a2-py3-none-any.whl (97.0 kB) Copy SHA256 Checksum SHA256 py3 Wheel Aug 20, 2017

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting