Skip to main content

A Python package for creative coding on the web.

Project description

proceso

A Python package for creative coding on the web.

proceso provides a Pythonic interface to the p5.js library. The package is designed for Pyodide-based environments including PyScript and (soonish) JupyterLite. Similar to py5, proceso's goal is to integrate p5.js into the Python ecosystem with thoughtful choices about how to do so in the browser.

Here is an example of how to create a proceso sketch with PyScript:

<!DOCTYPE html>
<html lang="en-us">

<head>
    <title>Bouncing Ball</title>
    <meta charset="utf-8" />

    <link rel="stylesheet" href="https://pyscript.net/releases/2023.03.1/pyscript.css" />
    <script defer src="https://pyscript.net/releases/2023.03.1/pyscript.js"></script>
    <link rel="stylesheet" href="./style.css" />
    <script src="https://cdnjs.cloudflare.com/ajax/libs/p5.js/1.6.0/p5.min.js"></script>
    <py-config>
        packages = ["numpy", "proceso"]
    </py-config>
</head>

<body>
    <main></main>
    <py-script src="sketch.py"></py-script>
</body>

</html>
import proceso as p5


pos = p5.Vector(200, 200)
vel = p5.Vector.random(2)
r = 25


def setup():
    p5.create_canvas(400, 400)
    p5.background("#1e90ff")
    p5.fill("orchid")
    p5.stroke(255)


def draw():
    global pos, vel
    pos += vel

    p5.circle(pos.x, pos.y, 2 * r)

    if pos.x < r or pos.x > p5.width - r:
        vel.x *= -1
    if pos.y < r or pos.y > p5.height - r:
        vel.y *= -1

    if p5.mouse_is_pressed == True:
        p5.background("dodgerblue")


p5.run(setup=setup, draw=draw)

Roadmap

  • Improve documentation
  • Fix bugs (i.e., load_model())
  • Translate p5.js test suite?
  • Support JupyterLite
  • Add CLI with hot reload
  • Add bindings for p5.js addon libraries

Acknowledgements

  • proceso is, first and foremost, an interface to the p5.js library. Nearly all of the package's documentation and examples are adapted from their p5.js counterparts. Portions of the source code are also adapted from the original JavaScript implementation.
  • The Vector class is lovingly borrowed from py5.
  • Basthon, Py5.js, and pyp5js all pointed the way.

Project details


Download files

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

Source Distribution

proceso-0.0.2.tar.gz (57.6 kB view details)

Uploaded Source

Built Distribution

proceso-0.0.2-py3-none-any.whl (63.3 kB view details)

Uploaded Python 3

File details

Details for the file proceso-0.0.2.tar.gz.

File metadata

  • Download URL: proceso-0.0.2.tar.gz
  • Upload date:
  • Size: 57.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.11

File hashes

Hashes for proceso-0.0.2.tar.gz
Algorithm Hash digest
SHA256 98e222ce5b1f4e769d0c2576fc076cea88fdb28256fa59dd7a434ac5551aae61
MD5 fdb171200d881179dce864beef89f89f
BLAKE2b-256 2f6032f1a9c59f1db3687fe043f2d94689ba0688ac138e52006049e1b21b28df

See more details on using hashes here.

File details

Details for the file proceso-0.0.2-py3-none-any.whl.

File metadata

  • Download URL: proceso-0.0.2-py3-none-any.whl
  • Upload date:
  • Size: 63.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.11

File hashes

Hashes for proceso-0.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 5f91afec3171e6597aa03015eb0e557627e39cc7e21d1f9442a6d756695123d8
MD5 d7909e86d86cf4c8ddd053aac6375c88
BLAKE2b-256 8ca7eec91c4f976ae0b556e2a96980c4da276d2c51759fd987fcefdb414e3dd7

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page