Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
55 changes: 55 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ You can learn more about this project from this [talk at LibreGraphicsMeeting 20

## Getting started

There is two different things at work here :
- libprocessing (this repo) is the low-level cross-platform library for the core Processing API. It's written in Rust, and thus lets write Processing sketches in Rust.
- mewnala is a Python package built directly from libprocessing, providing Python bindings for the library. It's available as any other Python package out there and lets you write Processing sketches in a Python environment, regardless of you having libprocessing or Rust installed.

### mewnala (the python library)

Inside of our `processing_pyo3` crate we have created a python package that you can easily install with pip.
Expand All @@ -28,21 +32,65 @@ powershell -ExecutionPolicy ByPass -c "irm https://astral.sh/uv/install.ps1 | ie
```

#### Install a mewnala

We're going to create a folder named `mewnala-sketchbook` and install the `mewnala` package inside:

```bash
# Initialize a project with uv
uv init mewnala-sketchbook && cd mewnala-sketchbook

# add the package
uv add mewnala
```

Now create a file named `sketch.py` at the root of `mewnala-sketchbook`.

You can use this code to test

```python
from mewnala import *

def setup():
size(400, 400)
background(255)

def draw():
push_matrix()
translate(mouse_x, mouse_y)
fill(255, 100, 200)
circle(0, 0, 50)
pop_matrix()

run()
```

Now run your sketch using:

```bash
# run a sketch
uv run sketch.py
```

_Note: you can use any file name you want for your sketch_

### Rust (libprocessing)

You'll need to install the Rust toolchain to work on this project. Most users will want to install Rust via [`rustup`](https://rustup.rs/), which helps manage Rust toolchain versions.

### Clone the project and its submodules

When cloning this repo (or your fork), don't forget to install its submodules (eg. Lygia)

```bash
git clone --recurse-submodules git@github.com:processing/libprocessing.git
```

if you already cloned the repo without `--recurse-submodules`, you can run

```bash
git submodule update --init
```

### Build commands

This project uses [just](https://github.com/casey/just) as a command runner:
Expand All @@ -65,6 +113,12 @@ Install [wasm-pack](https://rustwasm.github.io/wasm-pack/):
cargo install wasm-pack
```

On Windows, you'll need to manually install `wasm-opt`

```bash
cargo install wasm-opt
```

You'll also need the wasm32 target:

```bash
Expand All @@ -84,6 +138,7 @@ This outputs the package to `target/wasm/`.
```bash
just wasm-serve
```
_Note: you'll need python installed on your machine to run this command_


## Contributing
Expand Down