arnaudmiribel / streamlit-extras

Discover, try, install and share Streamlit re-usable bits we call "extras"!
https://extras.streamlit.app
Apache License 2.0
737 stars 125 forks source link

Update deprecated st.experimental_rerun() in stateful_button for st.rerun() #219

Closed r-moret closed 6 months ago

r-moret commented 7 months ago

This pull request subtitutes the method st.experimental_rerun() used in the extra stateful_button for its stable version st.rerun().

This is asked in the issue #218 as the deprecated method logs a warning specifying that it will be removed soon (2024-04-01).

netlify[bot] commented 7 months ago

Deploy Preview for phenomenal-crepe-0effec failed.

Name Link
Latest commit 3b411d7a6bbd5cf1cbbecd8f88e4067eb76f69e3
Latest deploy log https://app.netlify.com/sites/phenomenal-crepe-0effec/deploys/65f2a7bfec71c400087796ae
arnaudmiribel commented 7 months ago

Hey @r-moret! Thanks a lot for this PR. Would you mind making this compatible with older versions of streamlit, too?

For example, this is how we handle the method changes for caching primitives (source)

An equivalent here may be:

try:
    from streamlit import rerun
except ImportError:
    from streamlit import experimental_rerun as rerun 

# use `rerun` in the rest of the app
RitikShah commented 6 months ago

Any progress on this, we are getting closer to April 1st!

r-moret commented 6 months ago

Thank you for your feedback @arnaudmiribel!

I've just added to the PR the commit to allow compatibility with older versions! If there's something else you think would be good to add here just let me know!