Version 1.5.0

Notable Changes

  • :star2: Favicon defaults to a PNG to allow for transparency (#4272).
  • :vertical_traffic_light: Select Slider Widget now has the disabled parameter that removes interactivity (completing all of our widgets) (#4314).

Other Changes

  • :abc: Improvements to our markdown library to provide better support for HTML (specifically nested HTML) (#4221).
  • :open_book: Expanders maintain their expanded state better when multiple expanders are present (#4290).
  • :ballot_box: Improved file uploader and camera input to call its on_change handler only when necessary (#4270).
7 Likes

Great work

Just curious why st.image didn’t get the disabled parameter? That’s actually one I expected to have the “view fullscreen image” either enabled or disabled :slight_smile:
I sometimes accidentally click an image while scrolling on touchpad which takes me to the full screen image so would love to have that functionality be a choice :+1:

Also noticed some weird behaviour with small images in columns like with this little cryptocurrency dashboard I’ve built for my friends:

The “view fullscreen” toggle pops up on top of my BTC image when I hover over the yellow BNB image making the BTC image not visible anymore:


Toggle pops up on my CAKE image when I hover over the BTC image:

Toggle pops up all the way on the right when I hover over the CAKE image:

When the yellow BNB image is clicked it shows the little image all the way on the left while the close fullscreen button is all the way top-right and easy to miss:

I’ve closed this fullscreen page with the ctrl+w hotkey a little more than I’d like to admit thinking the image popped up in a new browser tab because I didn’t immediately see the close fullscreen button which meant I closed the entire page of the streamlit app :sweat_smile:

I’d love to be able to disable the view fullscreen ability of images because of this.

I found after updated to 1.5.0, some css set through mardown is disappear and got AttributeError :joy:
I return back to version 1.2.0, css effect is back and AttributeError is disappear.
In the process, program code has no change.

Hey @BeyondMyself ! Any chance you can provide the culprit code sample. Would love to investigate what’s causing the encode error.

I will make sure disabling full screen gets a look at for the future. We targeted widgets which, when changed, causes a rerun. We wanted to disable that.

1 Like

Actually, it report AttributeError, like this, in 1.2.0, it does not have this error:

I checked the error content, it maybe occured at this line:

st.set_page_config(page_title='切片PRB计算工具', page_icon='PRB.ico', layout='wide', initial_sidebar_state='auto')

Dose 1.5.0 not support ico format file as page_icon?

AttributeError: ‘NoneType’ object has no attribute ‘encode’

Traceback:

File "c:\python38\lib\site-packages\streamlit\script_runner.py", line 379, in _run_script
    exec(code, module.__dict__)File "G:\mypath\Python\prb.py", line 30, in <module>
    st.set_page_config(page_title='切片PRB计算工具', page_icon='PRB.ico', layout='wide', initial_sidebar_state='auto')File "c:\python38\lib\site-packages\streamlit\commands\page_config.py", line 102, in set_page_config
    msg.page_config_changed.favicon = image.image_to_url(File "c:\python38\lib\site-packages\streamlit\elements\image.py", line 300, in image_to_url
    this_file = in_memory_file_manager.add(data, mimetype, image_id)File "c:\python38\lib\site-packages\streamlit\in_memory_file_manager.py", line 261, in add
    file_id = _calculate_file_id(content, mimetype, file_name=file_name)File "c:\python38\lib\site-packages\streamlit\in_memory_file_manager.py", line 72, in _calculate_file_id
    filehash.update(bytes(mimetype.encode()))

AttributeError: ‘NoneType’ object has no attribute ‘encode’

Traceback:

File "c:\python38\lib\site-packages\streamlit\script_runner.py", line 379, in _run_script
    exec(code, module.__dict__)File "G:\mypath\Python\smarthippo.py", line 12, in <module>
    st.set_page_config(page_title="Smart Hippo使用情况登记", page_icon="globe.ico", layout='wide',File "c:\python38\lib\site-packages\streamlit\commands\page_config.py", line 102, in set_page_config
    msg.page_config_changed.favicon = image.image_to_url(File "c:\python38\lib\site-packages\streamlit\elements\image.py", line 300, in image_to_url
    this_file = in_memory_file_manager.add(data, mimetype, image_id)File "c:\python38\lib\site-packages\streamlit\in_memory_file_manager.py", line 261, in add
    file_id = _calculate_file_id(content, mimetype, file_name=file_name)File "c:\python38\lib\site-packages\streamlit\in_memory_file_manager.py", line 72, in _calculate_file_id
    filehash.update(bytes(mimetype.encode()))

According to our docs, our page icons just need to be supported by st.image. Would st.image('PRB.ico') work? You said you also downgraded to 1.2.0. It works for that use case? If you test 1.3.1 and 1.4.0, we can determine what change might have broken it.

I tried 1.2.0, 1.3.0, 1.4.0, page_icon=“globe.ico” can run normally, after upgrade to 1.5.0,
AttributeError: ‘NoneType’ object has no attribute ‘encode’ occurs.

1.5.0 supports emoji as page_icon well.

Adding -m streamlit.cli run in run config (pycharm) results in the following error:

Traceback:

Traceback (most recent call last):
File “/miniforge3/envs/py39/lib/python3.9/runpy.py”, line 197, in _run_module_as_main
return _run_code(code, main_globals, None,
File “/miniforge3/envs/py39/lib/python3.9/runpy.py”, line 87, in _run_code
exec(code, run_globals)
File “/miniforge3/envs/py39/lib/python3.9/site-packages/streamlit/cli.py”, line 301, in
main()
File “/miniforge3/envs/py39/lib/python3.9/site-packages/click/core.py”, line 829, in call
return self.main(*args, **kwargs)
File “/miniforge3/envs/py39/lib/python3.9/site-packages/click/core.py”, line 782, in main
rv = self.invoke(ctx)
File “/miniforge3/envs/py39/lib/python3.9/site-packages/click/core.py”, line 1259, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File “/miniforge3/envs/py39/lib/python3.9/site-packages/click/core.py”, line 1066, in invoke
return ctx.invoke(self.callback, **ctx.params)
File “/miniforge3/envs/py39/lib/python3.9/site-packages/click/core.py”, line 610, in invoke
return callback(*args, **kwargs)
File “/miniforge3/envs/py39/lib/python3.9/site-packages/streamlit/cli.py”, line 202, in main_run
_main_run(target, args, flag_options=kwargs)
File “/miniforge3/envs/py39/lib/python3.9/site-packages/streamlit/cli.py”, line 228, in _main_run
command_line = _get_command_line_as_string()
File “/miniforge3/envs/py39/lib/python3.9/site-packages/streamlit/cli.py”, line 214, in _get_command_line_as_string
assert parent.command_path == “streamlit”
AssertionError

Process finished with exit code 1

Works perfectly again when downgrading to 1.4.0

1 Like

Hey @flight505 - if you’re launching Streamlit from PyCharm, the “supported” way to do it is to set up your Run/Debug Configuration like so:

  • set the “Script path” to your project’s virtual environment’s Streamlit script (I use Pipenv, and so mine looks like “/Users/tim/.local/share/virtualenvs/lib-Kyu3_XmQ/bin/streamlit”)
  • set the “Parameters” to “run [your_streamlit_app.py]”
  • ensure the Python interpreter is set to your virtualenv’s Python binary
  • and make sure the project’s working directory is the directory that houses the main app script.

For example, here’s how I launch a Streamlit app called “streamlit_app.py”, which lives in my “/Users/tim/export/corp-streamlit” directory:

(If you’re on Mac or Linux, a quick way to get the path of your environment’s streamlit script is to do $ which streamlit from a terminal that you’ve activated the venv within.)

4 Likes

Thanks @tim, this works, but in my opinion is somewhat inconvenient.

That’s because it creates a separate run/debug configuration that PyCharm does not associate with the relevant script (in your example streamlit_app.py). Thus, when right-clicking streamlit_app.py in PyCharm’s file explorer the run/debug options there do not invoke streamlit correctly.

I can get around this by starting streamlit from within Python, via the bootstrap hack, although I understand that this not supported and has some issues.

Overall, I think it would be great if there was an official way of invoking streamlit from within python.

:100: :facepunch:Thank you for caring about the expanders. Feeling > functionality. A software won’t make it, no matter the features, if it just feels broken from the start. Looking into expander state is showing me you definitely know what’s important :exclamation: This has been bugging me for so long. Thank you so much for your work :call_me_hand:

Hey @BeyondMyself Sorry for the delay, but we have tested this out, and we see the issue. We’ve fixed the issue and just released it in our patch release (1.5.1) Thank you very much for letting us know and catching this!

Thank you. problem is solved in 1.5.1.

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.