Version 0.81.0

Release date: Apr 29, 2021

Highlights

  • :memo: 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
  • :abc: Introducing st.caption : A convenience API for for adding small text.
  • :art: Updates to Theming which allow for editing themes from a base theme configuration
  • :rocket: Improvements to deployment experience to Streamlit Sharing from the app menu

Other changes

  • Support for binary files in Custom Components (#3144)

Check out the release app for more details!

15 Likes

Also part of this release, Updates to Theming!!

Wanna add a hint of branding to Streamlit? Try replacing our signature pink color with your own! For e.g.

[theme]
base = "light"
primaryColor = "#1c83e1"  # Make it blue!

To learn more check out our theming docs

5 Likes

Hi,

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."

Thanks for your help!

1 Like

Hi @Lior_D,

did you try to use the with-statement way of doing it and does it work with it?

with st.form('Form2'):

Cheers
Chris

Hi,

Thanks for your reply,
I have been trying both ways.
I am copy and pasting the examples directly from the blog.
Just now I have retried this:

with st.form(key='my_form'):
	text_input = st.text_input(label='Enter some text')
	submit_button = st.form_submit_button(label='Submit')

Which I copied from the blog post

Thanks,
L

Hi @Lior_D

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.

Hi,

I did some more digging and have found the issue.
When I run in a standard way, from terminal
$ streamlit run user_auth.py
It works as expected.

However, I develop using the bootstrap module like so:
(I’m using this launch method so I can debug my code better)

from streamlit import bootstrap
real_script = "user_auth.py"
bootstrap.run(real_script, f'run.py {real_script}', [] , {})

The issue is reproduced.

My env:
Ubuntu linux 21.04 (reproduced in windows 10), running pyCharm.
Python environment: anaconda, interpreter python 3.8.8
Streamlit version

(py38) lior@lior-ubuntu:~$ streamlit version 
Streamlit, version 0.81.0

Thanks,
Lior

Hi there,

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?

Thanks,
LeChuck

Hey @LeChuck !

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! :slight_smile:
Thanks anyway.
Cheers

@Lior_D did you manage to deploy your app with st.form at the end? I am facing the same issue :confounded: with version 0.82.0

@kmcgrady any update from your side on how this could be resolved?

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.

3 Likes

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.

@coxi
Hi, no unfortunately not yet.

@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.

Thanks,
L

Hey I’m experiencing the exact same issue, tried to change the code countless times but nothing works. Did you find a solution? Thanks

Hey @Lior_D, @fedegaucho, @coxi,

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:

export PYTHONBREAKPOINT="pudb.set_trace"

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

Attaching my original question on the same: How can I invoke streamlit from within python code? - #2 by Jacob_Lukose

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?