arnaudmiribel / streamlit-extras

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

🐛 [BUG] - Markdownlit #136

Closed ditlevjoergensen closed 1 year ago

ditlevjoergensen commented 1 year ago

Description

In Markdownlit it uses "st.experimental_memo" which should be changed to "st.cache_data". Using st.experimental_memo I've found that my app crashes on importing markdownlit (from markdownlit import mdlit) with the error "streamlit.errors.StreamlitAPIException: set_page_config() can only be called once per app"

Reproduction steps

1. pip install markdownlit
2. from markdownlit import mdlit
3. produce error; streamlit.errors.StreamlitAPIException: `set_page_config()` can only be called once per app, and must be called as the first Streamlit command in your script.

Screenshots

No response

Logs

2023-04-04 09:33:01.064 `st.experimental_memo` is deprecated. Please use the new command `st.cache_data` instead, which has the same behavior. More information [in our docs](https://docs.streamlit.io/library/advanced-features/caching).
2023-04-04 09:33:01.067 `st.experimental_memo` is deprecated. Please use the new command `st.cache_data` instead, which has the same behavior. More information [in our docs](https://docs.streamlit.io/library/advanced-features/caching).
2023-04-04 09:33:01.095 Uncaught app exception
Traceback (most recent call last):
  File "C:\Users\DitlevHome\Desktop\Python_Projekts\streamlit_projects\CV\CV\.venv\Lib\site-packages\streamlit\runtime\scriptrunner\script_runner.py", line 565, in _run_script
    exec(code, module.__dict__)
  File "C:\Users\DitlevHome\Desktop\Python_Projekts\streamlit_projects\CV\CV\0_🏠_Home.py", line 40, in <module>
    st.set_page_config(page_title=PAGE_TITLE, page_icon=PAGE_ICON, layout="wide")
ine 311, in wrapped_func
    result = non_optional_func(*args, **kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\DitlevHome\Desktop\Python_Projekts\streamlit_projects\CV\CV\.venv\Lib\site-packages\streamlit\commands\page_config.py", line 225, in set_page_config
    ctx.enqueue(msg)
  File "C:\Users\DitlevHome\Desktop\Python_Projekts\streamlit_projects\CV\CV\.venv\Lib\site-packages\streamlit\runtime\scriptrunner\script    raise StreamlitAPIException(
streamlit.errors.StreamlitAPIException: `set_page_config()` can only be called once per app, and must be called as the first Streamlit command in your script.

For more information refer to the [docs](https://docs.streamlit.io/library/api-reference/utilities/st.set_page_config).

Version of streamlit

1.20.0

Version of streamlit-extras

0.2.7

arnaudmiribel commented 1 year ago

Hey @ditlevjoergensen! Thank you for raising this. Just released a new version of markdownlit to support new caching primitives. Can you upgrade and let me know if that works?