Version 1.32.0

Alert: We’ve discovered an inefficient use of CPU for Streamlit version 1.32.0 and 1.32.1 and blocked their use on Community Cloud. Patch 1.32.2 has been released on PyPi and is available for development and deployment to Community Cloud.

Highlights

  • :popcorn: Introducing st.popover to create popover elements in your Streamlit apps. Check out the docs to see how to use it!

Notable Changes

  • :tv: You can now pass subtitles to st.video! Check out our feature demo.
  • :alembic: AppTest includes support for st.expander and st.status.
  • :test_tube: AppTest.from_function accepts a function that takes arguments and/or returns a value.
  • :jigsaw: The timeout warning for custom components was replaced with an element skeleton to improve the UX for slow-loading components, especially in some cloud-hosted platforms (#8179, #7046).
  • :page_facing_up: st.switch_page and st.page_link received significant improvements to path handling, performance, and visual appearance (see below for details).
  • :crab: Bug fix: Streamlit uses glide-data-grid version 6.0.4 to fix a variety of dataframe issues (#7779, #6900, #7032, #7727, #6810, #7930, #7949, #7831, #8168).
  • :sweat_drops: Bug fix: We’ve plugged a significant memory leak in the coroutine loop. Apps that generate a large number of small messages between client and server will benefit greatly (#8068, #7989, #6510).

Other Changes

  • :muscle: Multiple modules are now lazy-loaded to speed up Streamlit’s import time (#8150, #8143, #8134, #8113, #8125, #8111, #8109, #6066).
  • :framed_picture: st.write supports PIL images (#8039).
  • :link: st.radio allows markdown links within the items passed to options (#8028, #7992).
  • :skull: The deprecation.showPyplotGlobalUse config option is deprecated and will be removed in the subsequent release (#8133).
  • :robot: Streamlit supports AzureOpenAI chat stream (#8107, #8084).
  • :globe_with_meridians: The /healthz endpoint supports the HTTP HEAD method (#8145, #8144). Thanks, rahulmistri1997!
  • :cyclone: The cache parameter for st.spinner is now private (_cache) since it’s for internal use (#8118).
  • :running_man: Session storage is checked and expired asynchronously to improve performance and efficiency of apps with lower traffic (#8083).
  • :ant: st.write_stream raises a descriptive Exception when the message cannot be parsed (#8036).
  • :blue_book: Fixed a typo in the examples for st.switch_page and st.page_link (#8162). Thanks, t1emp0!
  • :ghost: Bug fix: st.help correctly displays conditional members (#8228).
  • :butterfly: Bug fix: App State fully clears on page change to prevent lingering stale elements (#8208).
  • :lizard: Bug fix: st.info, st.success, st.warning, and st.error don’t overflow with long markdown strings (#8194, #6394).
  • :snail: Bug fix: Streamlit shows a warning that port 3000 is reserved for development when the server port is set to 3000 (#8152, #8149).
  • :spider_web: Bug fix: st.page_link and st.switch_page have improved path calculation for consistency (#8127).
  • :cricket: Bug fix: st.page_link shows the correct path in browser on hover (#8086, #8080).
  • :scorpion: Bug fix: st.page_link and st.switch_page normalize paths for correct handling in Windows (#8103, #8070).
  • :mosquito: Bug fix: Script runner uses a while loop instead of recursion to avoid stack overflows (#8100).
  • :microbe: Bug fix: st.page_link and st.switch_page correctly handle relative paths prefixed with "/" (#8085, #8081).
  • :fly: Bug fix: st.image parses paths in Windows correctly (#8092, #7271, #6066).
  • :cockroach: Bug fix: st.switch_page no longer waits for the current page to finish running before switching pages (#8054, #7954).
  • :spider: Bug fix: st.map and other simple charts correctly handle color when data is not indexed starting from 0 (#8158, #8079, #8077). Thanks, awhazell!
  • :lady_beetle: Bug fix: st.selectbox, st.multiselect, st.select_slider, and st.radio use shallow copies of their options to prevent unexpected mutations (#8064, #7534).
  • :honeybee: Bug fix: The selected time in st.time_input displays correctly in dark mode (#8056, #7436).
  • :beetle: Bug fix: Dataframe scrollbars display correctly in the latest version of Chrome (#8034).
  • :bug: Bug fix: Casting st.query_params to str will print the content of the query parameters instead of the class description (#8030).
8 Likes

Love it! Thank you! :+1: :+1:

  

Popover - Live Example #1 - Ticket Stream

menu = st.popover("🧭 Menu")

menu.page_link(
  "Home.py", 
  label="Home", 
  icon="🏠", 
  use_container_width=True
)

menu.page_link(
  "pages/0_Mobile.py", 
  label="Mobile App", 
  icon="📱", 
  use_container_width=True
)

menu.page_link(
  "pages/1_Main.py", 
  label="Desktop App", 
  icon="🖥️", 
  use_container_width=True
)

menu.page_link(
  "pages/6_Dev_Page.py", 
  label="Dev Page", 
  icon="💻", 
  use_container_width=True
)

Streamlit_Popover_2

  

Popover - Live Example #2 - Fin Stream

menu = col1.popover("🧭 Menu", use_container_width=False)

menu.page_link(
    "Home.py", 
    label="Home", 
    icon="🏠", 
    use_container_width=True
)

menu.page_link(
    "pages/0_Dashboard.py", 
    label="Dashboard", 
    icon="💵", 
    use_container_width=True
)

menu.page_link(
    "pages/1_SEC_Filings.py", 
    label="SEC Filings", 
    icon="⚖️", 
    use_container_width=True
)

Streamlit_Popover_1

5 Likes

Streamlit 1.32.0 seem to flicker ‘Test1’ text when iframe component height is zero. Thus the illusion of infinite loop.

Step to reproduce
install streamlit-cookies-controller

pip install streamlit-cookies-controller==0.0.2

Write a page app

import streamlit as st
from streamlit_cookies_controller import CookieController, RemoveEmptyElementContainer

st.set_page_config('Cookie QuickStart', '🍪', layout='wide')

controller = CookieController()
# RemoveEmptyElementContainer()

# to check how many time 
if 'count' not in st.session_state:
    st.session_state['count'] = 0
st.session_state['count'] += 1
count = st.session_state['count']
st.write(f"Total script run count: {count}")

# Set a cookie
controller.set('cookie_name', 'testing')
st.write(st.session_state)

streamlit-temp-2024-03-09-11-03-64

Love the Popover.

1 Like

Fun popover

2 Likes

@Nathan_Chen Thank you😀

Is that a button menu?

They are page links and widget under popover. Styles are done with some css hacking.

Page link

st.page_link('pages/contact.py', label='Contact', icon='📞')

Custom container under popover

    with cols[2]:
        menu = st.popover("🛠️ Project")
        with menu.container(border=False):
            str_html = '''
                <strong>Upcoming Projects</strong>
                <ol>
                  <li><a href="https://www.amnh.org/explore/ology/astronomy/the-milky-way-galaxy2#:~:text=The%20Milky%20Way%20is%20a,the%20center%20of%20the%20galaxy.">Milky Way</a></li>
                  <li><a href="https://www.britannica.com/topic/Andromeda-Greek-mythology">Andromeda</a></li>
                </ol>

                <strong>Completed Projects</strong>
                <ol>
                  <li><a href="https://www.worldatlas.com/space/the-ten-largest-galaxies-in-the-universe.html">UGC 2885</a></li>
                  <li><a href="https://en.wikipedia.org/wiki/Hercules_A">Hercules A</a></li>
                </ol>
            '''
            st.markdown(str_html, unsafe_allow_html=True)

Or create a project page called pages/milkyway.py and use it in the list such that when it is clicked, it will redirect us in our own project page.

url = 'http://localhost:8501'
<li><a href="{url}/milkyway" target="_self">Milky Way</a></li>

When this line is hovered, we change the color.

<style>
    a:hover { /* anchor color on hover */
        background-color: yellow;
    }
</style>

Page links under popover

    with cols[1]:
        menu = st.popover("📚 Blog")
        menu.page_link(
            "pages/basketball.py", 
            label="Basketball", 
            icon="🏀", 
            use_container_width=False
        )
        menu.page_link(
            "pages/soccer.py", 
            label="Soccer", 
            icon="⚽", 
            use_container_width=False
        )
2 Likes

Thanks, it looks really nice. I liked the idea to pack in HTML into the popup too.

2 Likes

The Fin Stream looks fantastic! Could you please provide some instructions on how to build this animation?

2 Likes

Nice work @ferdy!

This is fun (:

st.popover

5 Likes

I want there to be numbers on them and the option to roll them… :laughing:

2 Likes

That’s awesome. Nice work.

Am I the only one having troubles with st.popover today via the community cloud while having streamlit==1.32.0 in the github requirement.txt file. Same with streamlit==1.32.1 and streamlit==1.32.*. Worked perfectly Yesterday through.

Traceback:

File "/home/adminuser/venv/lib/python3.11/site-packages/streamlit/runtime/scriptrunner/script_runner.py", line 535, in _run_script
    exec(code, module.__dict__)File "/mount/src/ta/pages/Zeus v2.py", line 110, in <module>
    with col1.popover("Candles", use_container_width=True) :
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^File "/home/adminuser/venv/lib/python3.11/site-packages/streamlit/delta_generator.py", line 352, in wrapper
    raise StreamlitAPIException(message)

with “popover() is not a valid streamlit command” in the terminal log.

AttributeError: module 'streamlit' has no attribute 'popover'
1 Like

@sponge, it is not just you:

1 Like

I’ve just updated the post with a link to the current incident to hopefully improve visibility until it gets resolved.

3 Likes

I’ve updated the comment about the Community Cloud restriction:

We’ve discovered an inefficient use of CPU for Streamlit version 1.32.0 and 1.32.1. Apps deployed on Community Cloud are temporarily capped at version 1.31.1. Patch 1.32.2 has been released on PyPi and is available for development. The limitation for Community Cloud is expected to be lifted on Monday, March 18.

2 Likes