p5 is a Python library that provides high level functions to work with graphics. p5 combines the core ideas of Processing — learning to code in a visual context — with Python's readability to make programming more accessible to beginners and artists.

p5 borrows Processing's metaphor of software "sketches". A typical sketch looks like:

    from p5 import *

    background_color = (0.1, 0.1, 0.1, 1.0)

    def setup():
        size(800, 600)
        title("Example Sketch")

    def draw():

        with push_matrix():
            translate(160, 150)

            fill(1.0, 0.6, 0.0, 1.0)
            square((-30, -30), 60)
            square((-30, -50), 20)

            square((-10, -10), 20)

        with push_matrix():
            translate(240, 170)

            fill(1.0, 0.8, 0.0, 1.0)
            rect((-30, -50), 60, 100)

            rect((-30, -30), 40, 20)
            rect((-10, 10), 40, 20)

    if __name__ == '__main__':
...and, when run, produces:

Sample sketch output

p5 requires Python 3. Once you have that installed, you can then run

    pip install p5
from the command line. p5 includes a test script and you can run

   >>> import p5
   >>> p5.sketch.test_run()
from the interactive prompt to view the test render.

All development work happens on the develop branch and master has the (somewhat) stable releases uploaded to PyPI. The project documentation is hosted on ReadTheDocs.

See the project repo for more details.