TangleSpace / hydralit

A library to create multi-page Streamlit applications with ease.
Apache License 2.0
202 stars 19 forks source link

The api of streamlit.script_run_context api has changed #27

Closed cgx9 closed 2 years ago

cgx9 commented 2 years ago

https://github.com/TangleSpace/hydralit/blob/ecaec562aedc3854c2dbae9be76e9a679da228b9/hydralit/sessionstate.py#L8

at streamlit‘s latest version,it use scriptrunner package:

from streamlit.scriptrunner import get_script_run_ctx
fredzannarbor commented 2 years ago

(unity) fred@Freds-MacBook-Pro:~/bin/nimble/unity$ /Users/fred/.virtualenvs/unity/bin/python /Users/fred/bin/nimble/unity/app/utilities/LeoBloom/LeoBloom.py Traceback (most recent call last): File "/Users/fred/bin/nimble/unity/app/utilities/LeoBloom/LeoBloom.py", line 4, in from hydralit import HydraHeadApp File "/Users/fred/.virtualenvs/unity/lib/python3.8/site-packages/hydralit/init.py", line 5, in from hydralit.hydra_app import HydraApp File "/Users/fred/.virtualenvs/unity/lib/python3.8/site-packages/hydralit/hydra_app.py", line 4, in from hydralit.sessionstate import SessionState File "/Users/fred/.virtualenvs/unity/lib/python3.8/site-packages/hydralit/sessionstate.py", line 8, in from streamlit.script_run_context import get_script_run_ctx ModuleNotFoundError: No module named 'streamlit.script_run_context'

AEB26B commented 2 years ago

am I missing something? Even from streamlit.scriptrunner import get_script_run_ctx does not work for me

TangleSpace commented 2 years ago

it's because Streamlit keep changing this method name over and over and over, people want to keep installing the latest version of Streamlit and hence why all these community packages keep breaking and why i wait so long until i push the fix, as there are now 4 branch conditions required in the code to correctly account for all the variations in the method name to get the session context.

v1.7.0

from streamlit.script_run_context import get_script_run_ctx to

v1.8.0

from streamlit.scriptrunner.script_run_context import get_script_run_ctx

AEB26B commented 2 years ago

in my case I just needed to reload VSCode as I had reinstalled the newer version of streamlit locally but forgot to restart. Woopsie. Someone accidentally regenerated the pipfile in our repo and we hadn't forced a version so we inadvertently ended up on 1.8.1 without any warning. Lot of dashboards need rewriting now haha. We were on such an old version our code still has beta_columns in it.

TangleSpace commented 2 years ago

New version 1.0.13 release now supports Streamlit >=1.9, until Streamlit decide to change more shit and break Hydralit again.