Code streamlit code within streamlit app

Hi everyone! Thinking of how to show others how amazing Streamlit is, I did this small app to write Python+Streamlit code and see the effects directly in the same app. I think this would be good for my students and hopefully you will find it useful too :wave:.



LOVE IT bananadance

1 Like

Thanks @Marisa_Smith :wave:

Simple and effective!!! Nice job, thanks!

This is an awesome use case of Streamlit that I’ve explored myself. Something to be super careful of is to warn your students never ever ever to run this sort of server on a publicly facing web socket on their own personal machine (and to a lesser extent even on secure web hosted servers). Allowing arbitrary python code to run essentially gives any average user the same level of control as the web developer. As an example, all the user has to do is type out a while true infinite loop and the server is brought to its knees. In a web hosting environment, a user could tell the server to download an endless supply of files causing the web developer to rack up thousands in bandwidth fees. There are ways to lock this down (computational time limits, isolated python environments, limit external internet access, etc.) but they do vastly complicate what is otherwise a super easy way of letting a user run their own code in a no setup educational like environment.


Totally agree Jonathan. For now the app was shut down until a better solution is found. Thanks for pointing that out.


Can I get the source code as to run locally for my students?

Hi @tranhoangnguyen03 the code is fairly simple, you can see it here.

Although I would recommend to use the Streamlit Snippets by one of the Streamlit engineers.