Executing user python code using Pyodide instead of in the Streamlit script/backend

Hi guys,

I am working on a Streamlit notebook app that is basically a Jupyter notebook environment but in a Streamlit app and in the process, I needed a way to run python code more securely (preferably in on the client). I found Pyodide to fit the bill for creating a python interpreter and I built a couple custom components to make it possible to add the interpreter to Streamlit apps and to pass code to the interpreter and get the responses back.

This idea is not new. In fact, I found a discussion on it from 2022 and it seems that some people have built related projects before.

Anyways, so far the package I made really only does what I need it to do. I was wondering if there is any level of interest in this kind of thing and if I should put more effort in fleshing the project out to make it more useful for others.

Here is the project:

Let me know if you find this interesting!

4 Likes

Hi there,

I found your project very interesting and believe it has great potential, especially in the education industry where tools like this are highly needed. Although it currently seems not to render graphical outputs, what you have accomplished is a significant first step.

Thank you for sharing this, and I look forward to seeing its further development!

Best regards

2 Likes

Great idea! It seems possible for Matplotlib

1 Like

Wow, that’s amazing!

I was thinking of graphical outputs like turtle or pygame. From my experience, Replit can run these modules online. It used to let us embed programs in any website with an iframe, and we could see the results without logging in. Now, users need to log in to see the results, which makes many interesting projects less accessible since there’s an extra step to sign up and log in before they can run, which is a pity.

My needs might be specific, but your project has great potential. Keep up the great work, and it would be awesome to see such features in the future.

Best

1 Like

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.