jtpio / ipyp5

p5.js Jupyter Widget
BSD 3-Clause "New" or "Revised" License
41 stars 5 forks source link

pyp5js #4

Open jf--- opened 5 years ago

jf--- commented 5 years ago

The readme.md states that

The ideal goal (disclaimer: not implemented yet) would be to write code like this in a notebook cell

looks like pyp5js just might be the ticket?

jtpio commented 5 years ago

It does looks like a great tool indeed.

Thanks @jf--- for sharing this!

jaladh-singhal commented 3 years ago

I was about open an issue to share pyp5js which can be helpful to this project to achieve its goals.

Apparently pyp5js, don't really allows you to display canvas within Jupyter notebook but in a separate html file running on a http server. @jtpio I'd really love to see that ipyp5 can utilize pyp5js in some way to make p5.js work within notebook as widgets while allowing to write pure native Python code. :raised_hands:

jtpio commented 3 years ago

Thanks @jaladh-singhal!

Yes pyp5js looks like the most promising way to get that to work.

Maybe using a pyodide mode: https://github.com/berinhard/pyp5js/issues/124

Or using some parts from https://github.com/berinhard/pyp5js/pull/123, with direct calls to pyodide.runPython(code) from the widget frontend.

berinhard commented 3 years ago

Hi everyone! Veeeery cool project you're developing over here! Let me know how I can help with anything. About the pyodide integration, I organized it a little bit better in this demo. It's still a proof of concept and a few things can break (pop for example), but at least it's a reference.

I'll watch the repo and check if I can help with something. I've went through a lot of things trying to make pyp5js to work that can sum to ipyp5 as well.

jtpio commented 3 years ago

Thanks @berinhard!

This demo is going to be very useful, and the project is really exciting!

Looks like it might actually be simpler to try this approach of using pyp5js with pyodide in the p5 notebook first: https://github.com/jtpio/p5-notebook/issues/50

This would leave the issue of syncing the Python code over websockets using the Jupyter Widget protocol for later (but the learnings from p5 notebook could probably be backported here).