Quite new here. Discovered streamlit a few weeks ago, but I think the app I’m currently working on could be interesting to some of you.
It’s called StreamPy, a streamlit-based python interactive interpreter allowing to run streamlit commands and pop widgets interactively in the console’s queue. I added a basic text editor to work on longer scripts for convenience.
You can find the repo here or you can try the app here.
Still a work in progress (likely not bug-proof). Any feedback/contribution welcome with gratitude!
Let me know if giving users the possibility to run arbitrary python code from within the webapp may cause security problems. I mean it’s no big deal if a silly user destroys the app itself but I don’t mean to introduce vulnerability on your servers. My first guess was that the app’s execution environment is sandboxed in a virtual machine so I was not really worried…
Just found a way to remove threads entirely from the app without loosing any feature. Greatly simplifies and increases robustness of the code while avoiding thread-related session_state issues.
Just added the possibility to hide / show past input cells in the console’s queue.
Also implemented automatic key attribution so that calling twice a widget with same arguments without specifying a key results in two distinct keys/widgets created.
Streamlit’s native automatic key management somewhat produced weird results in some cases when using the deferrer.
Somewhat managed to handle sdtin redirection to an input dialog. Only working on local mode obviously.
Allows using built-in python input command, and more generaly handle all python functions requiring keyboard input.
I guess what is needed to make it work in the web app is a custom widget component for inputting text in a blocking way (stopping the streamlit’s script execution until the inputted text is returned). I hope it’s feasible within the constraints of streamlit runtime though… That would be neat !
Proud to announce that stdin redirection now works both in local mode or in the webapp. Created a custom input component for the purpose. It uses firebase to establish a direct communication between the streamlit “backend” and the js frontend (in a websocket fashion) in such a way that python may access the data returned by the widget instantly, without having to rerun the whole script.
You may therefore use the classic python ‘input’ command in the console :
txt=input(“Enter text here:”) #renders an input widget, python waits for its output
print(txt) # access the content returned by the widget immediately and print it.
Next step, implement proper user login via firebase, use it to save user files in cloud storage so that they persist accross various sessions (In the current implementation, accounts and user files are lost whenever the app goes to sleep).
If you think of any other feature I should add to make the most of this app, feel free to share your thoughts here !
I was also thinking about changing the name of the app, “Streampy” already exists as a python library… Any ideas ?
Yes, I’ve been working quite a bit on it lately, as much as my job schedule allows…
I indeed am on twitter (https://twitter.com/B4PT0R), though almost invisible there. I created my account only very recently and didn’t post much.
I gratefully accept your proposal to give Streampy a bit more visibility. The app definitely needs some user testing/feedback at this point, notably to set the direction and priority for the next improvements.
I’ll implement proper login and cloud storage via firebase in the next few days, so by the end of the week it should be ready to receive a bit more visits. I also need to make sure my secrets are protected enough to avoid silly users to use the python console to grab them. I realized last week that they just had to run:
import streamlit
st.write(streamlit.secrets)
in the console to get them… which was way too easy !
Found a workaround to that unwanted situation by overriding streamlit module directly in sys.modules with a mocking class so that it bans access to the ‘secrets’ attributes after init.
So yeah, by the week end, it should be good to go viral…
Improved security by restricting access to some modules, improved user log in and implemented cloud file storage so that you may access your files/scripts across sessions.
Hello @B4PT0R,
Sounds like a great project, though I haven’t been able to access your hosted project from the link posted within the original post.
Thanks!
Yeah, the old project has been shut down. I’ve worked a lot on it in the meanwhile to integrate GPT4 in the mix and I’m quite close now to release a new iteration more publicly. It’s called Pandora now. You can check it out here. The app also exists as a local client, feel free to check the repo for more info.
Minor things still need to be done to improve user experience, but it’s functional as is.
Requires an OpenAI API key to enjoy voice interaction an AI assistance, but can still be used as a mere python console (allowing to run live streamlit commands!) without.
You would be my first real user, so any feedback would be much appreciated !
Thanks for stopping by! We use cookies to help us understand how you interact with our website.
By clicking “Accept all”, you consent to our use of cookies. For more information, please see our privacy policy.
Cookie settings
Strictly necessary cookies
These cookies are necessary for the website to function and cannot be switched off. They are usually only set in response to actions made by you which amount to a request for services, such as setting your privacy preferences, logging in or filling in forms.
Performance cookies
These cookies allow us to count visits and traffic sources so we can measure and improve the performance of our site. They help us understand how visitors move around the site and which pages are most frequently visited.
Functional cookies
These cookies are used to record your choices and settings, maintain your preferences over time and recognize you when you return to our website. These cookies help us to personalize our content for you and remember your preferences.
Targeting cookies
These cookies may be deployed to our site by our advertising partners to build a profile of your interest and provide you with content that is relevant to you, including showing you relevant ads on other websites.