Introducing st.form and st.form_submit_button which allow for the creation of forms and submit button to batch submit input widgets. Check out our blog post
Introducing st.caption : A convenience API for for adding small text.
Updates to Theming which allow for editing themes from a base theme configuration
Improvements to deployment experience to Streamlit Sharing from the app menu
Other changes
Support for binary files in Custom Components (#3144)
I have been trying to run st.form and st.form_submit_button examples from the blog post.
form = st.form(key='my_form')
text_input = form.text_input(label='Enter some text')
submit_button = form.form_submit_button(label='Submit')
if submit_button:
st.write(f'hello {text_input}')
The result is the following error message:
" Missing Submit Button
This form has no submit button, which means that user interactions will never be sent to your Streamlit app."
Hmmmm…I just tried that code blob you posted right here, and it worked just fine. Are you sure you are on the latest Streamlit? Running streamlit version should let you know.
The st.form is a really cool feature! Thanks for that.
Generally it is working fine, but I noticed that custom components do not show up within a form.
Is this just not implemented yet, is it a bug, or is it just me?
I checked in with the team, and I believe it should show up just fine. Can you provide some example code to demonstrate the issue? I wonder if the custom component is not setting its height correctly.
Hi @kmcgrady,
Thanks for your reply.
While trying to make a minimal example, I noticed that there is an update 0.81.1.
After updating it is now working fine. Before it didn’t.
So, problem solved!
Thanks anyway.
Cheers
Thanks @coxi for reminding me. I think using bootstrap is a unique use case here. I don’t think we internally expected users to run scripts via bootstrap. I can forward this information to the team to consider.
Thanks for the quick reply. That would be really great!
As additional info, in my case I am trying to deploy the app using RStudio Connect, not sure what they use under the hood tho, but maybe also bootstrap.
@kmcgrady
We do not run scripts via bootstrap per se, rather we use it as an extremely useful development tool, so having any feature working on bootstrap is a prerequisite for us to be using it.
Yeah, kmcgrady is correct that we don’t really support using bootstrap in this way (because it’s just undocumented internals of Streamlit, which are all subject to change – as you’re seeing here :)).
However! We do support debugging Streamlit apps interactively. You can achieve this without using bootstrap. I do this with PyCharm - you can see it in this “Intro to Custom Components” youtube video, starting at about the 10 minute mark. The tl;dr is that you debug streamlit run myscript.py, rather than myscript.py:
You can see that “Script path” is set to <some_virtualenv_path>/bin/streamlit, and the “parameters” are set to run <scriptname.py>. (To discover the path to bin/streamlit within my virtual environment, I just ran which streamlit inside a shell with my virtualenv activated.)
When I set a breakpoint inside my script, PyCharm just works in the way you’d hope!
(I don’t use VSCode, but I imagine this should work there as well.)
Does this solve what you’re trying to do with bootstrap.py?
As a command-line freak, my one-liner solution is to just add this anywhere in my app’s code to start a debugger at that spot:
import pdb; pdb.set_trace()
Alternatively, on Python 3.7+ you can just use this:
breakpoint()
…and the cool part is that you can configure which debugger gets called with breakpoint() by setting the PYTHONBREAKPOINT environment variable. For example, to set pudb as your debugger you just need to put this in your bashrc:
Hi @kmcgrady , I support this usecase. I also use bootstrap to run my script. Basically this is the only solution to programmatically invoke streamlit script other than using command line. Also please let us know, if there are other solutions to achieve the same
Hey @tim , thank you for sharing this, is really helpful, and going to give it a try! Unfortunately, my problem it was that Rstudio connect seems to deploy every script with the bootstrapping method and therefore there’s no way to make forms work on their server. Anyway, I solved the issue by recreating the form using just buttons and now it works as expected!
@fedegaucho I’m not familiar with Rstudio, so I might be misunderstanding - are you saying that they have a Streamlit integration that relies on Streamlit internals?
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.