alexmojaki / pyodide-worker-runner

MIT License
22 stars 2 forks source link

Question: simple wrapper component #30

Open YoniChechik opened 1 year ago

YoniChechik commented 1 year ago

Hi, This project looks great but it's farbeyond my ubderstanding to make it work by myself.

is there a wrapper component to use to send in python code that will be interpreted including the ability to call "input" function?

if not, is there a complete example of usage? I want to try it on next13.

tomitrescak commented 1 year ago

Yoni, I was struggling with the same for past two weeks and came up with the following:

https://codesandbox.io/s/eager-williams-ly7fxf?file=/pages/index.tsx

It is a fully working example, but it does not do an interactive session, which I will track in #31

YoniChechik commented 1 year ago

from a first glance it looks amazing! For my use case I don't need pdb so it fits me.

The only question I have is why do you wnat to initialize the worker each run? wont it be faster to decouple the init from the run itself, and then if you run some code multiple times, the startup will be much quicker? (Forgive me if this is a silly question, I'm a js nub)

tomitrescak commented 1 year ago

Yoni, it should be easy to fix. That’s on recommendation from @alexmojaki

Frankly, I’m struggling to make this to an interactive session. Thus, if you manage to do so, please post it here.