Skip to content

Hot reload v2 - #283

Open
tychedelia wants to merge 1 commit into
processing:mainfrom
tychedelia:hot-reload-v2
Open

tychedelia wants to merge 1 commit into
processing:mainfrom
tychedelia:hot-reload-v2

Conversation

@tychedelia

Copy link
Copy Markdown
Member

Uses jurigged to hot reload our python sketches. It does some sketchy magic to patch functions in place rather than requiring a restart of the sketch.

There are now three ways to turn it on:

  • Programmatically with run(hot_reload=True)
  • Via env var PROCESSING_HOT_RELOAD=1
  • Or via our new processing_py module entrypoint that removes the need for explicit run entirely: python -m processing_py run --hot-reload sketch.py

@tychedelia
tychedelia requested a review from catilac November 18, 2026 20:59
@github-actions

Copy link
Copy Markdown

Visual regression: 1 changed of 43 cases

case status detail
py_flocking_gpu ❌ changed 7.95% of pixels differ

If these changes are intentional, add the deliberate-rendering-change label.

baseline 1c92b8812a · adapter llvmpipe (LLVM 20.1.2, 256 bits) (Vulkan, Mesa 25.2.8-0ubuntu0.24.04.5 (LLVM 20.1.2))

Open the visual report · workflow run

@catilac

catilac commented Nov 20, 2026

Copy link
Copy Markdown
Contributor

Haven't tested yet, but I like this direction a lot. We should think of a similarly shaped hot-reloading solution for Processing 5.0

@Nitish-bot

Copy link
Copy Markdown
Contributor

Tested this locally and hot reloading works really well. I tried all three ways of turning it on. I edited draw(), constants, a sibling module, and size() in setup(), and tried syntax and runtime errors. It recovered every time.

Found two things while testing:

  • Shader uniform values get lost if an edit stops using them for a bit. For example with create_material(shader, color=[0, 0, 1, 1]):
      1. change the shader to return vec4(1.0) * color; → box is blue (correct)
      1. change it to return vec4(0.0, 1.0, 0.0, 1.0); → green (correct)
      1. change it back to return vec4(1.0) * color; → box is gone, color is now all zeros

I think it's because the unused uniform gets stripped, so there's nothing to carry the value over from. It's pretty common to hit when you comment out a color for a second.

I also ran an LLM over the diff for a deeper look and left the few things that seemed worth it as comments on the code.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants