-
Notifications
You must be signed in to change notification settings - Fork 2.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
New API: st.set_page_config #1770
Comments
@akrolsmir This sounds like a great solution, looking forward to it! One question I'm curious about is the difference between "auto" and "expanded" for the initial sidebar state. My impression is that in either case, if any |
@benlindsay Thanks! "auto" and "expanded" will have different results depending on the width of the browser window. "auto" sidebar (aka today's behavior) starts expanded if the window is wider than a certain point, and starts collapsed otherwise. The two new options allow you to force the initial sidebar state one way or the other, ignoring browser width. Incidentally, I'm wondering whether it makes sense to show an empty sidebar when (in favor of showing the expanded empty sidebar: I don't think Streamlit is currently capable of looking forward through the app to detect whether there's an st.sidebar somewhere later, so as soon as st.set_page_config is called we'd need to make a decision) |
Oh, duh, forgot about the screen size thing! Sounds great 🙂 |
Hi @akrolsmir, thanks for putting this together! I'd love to test this out, but it looks like the latest available nightly release was from August 5th. Any idea when this feature will come out in a nightly release? |
Hi @akrolsmir, I'm using latest nightly. Although st.beta_set_page_config() is the first streamlit call, sometimes (not always) when I hit a st.button() I'm getting the error below.
For now, I'll try to avoid this error with a try/except... |
Hi @benlindsay, sorry we had some issues with the nightly over the past weekend but we just shipped out a release yesterday so you should be able to use this feature if you upgrade to the latest Streamlit version(0.65)! |
For anybody who arrived here and is looking for the fix: streamlit.set_page_config(page_title=None, page_icon=None, layout='centered', initial_sidebar_state='auto') Configures the default settings of the page. |
Proposal
Background
We want to support the following in Streamlit:
Must be first st command
For all of these settings, we'd prefer if the user sets them near the top of their script. Because it would be weird to have an app load, then show a bunch of stuff, and then change into wide mode, for example.
Immutable, for now
For title and favicon, it makes a lot of sense to support mutation. But it's not what 99% of the users will be doing, so it's OK if we don't support it at first.
For wide-mode and expand-sidebar, mutations make a lot less sense.
(Copied from our internal spec here)
The text was updated successfully, but these errors were encountered: