“Always Run” Setting

Hey all,

The “always run” setting does not persist across ST sessions - not sure if that’s a feature. The only way to make that setting sticky is to edit the (blank in my case) toml file. Checking the “run on save” checkbox/clicking “always run” didn’t touch the toml file. Perhaps it would be easier to prepopulate the toml file with default settings as a starting point for custom config, and to then persist the “always run” setting by modifying the runOnSave line?


Hey @Kyle_M ,

Just to confirm, when you choose “always rerun” via the UI the setting only lasts for that session — and this is indeed on purpose :grin:

To make the setting persist, you should add the following to the config file at ~/.streamlit/config.toml, as you noted:


runOnSave = true

The thinking behind that was that many of our early users started by taking an existing Python file which takes a long time to run and sprinkling some Streamlit magic on it. While they iterate on it they often save their work, either to make sure it doesn’t get lost if their editor crashes, or even just due to force of habit. With runOnSave turned on, while users are refactoring their script the rerun could be very CPU intensive and slow.

Or worse, many times the original script is destructive: rerunning it will overwrite some files, update a database, etc. This is something the user will likely want to fix as they convert the script to Streamlit, but while they’re still in the middle of this work it may still be an issue.

So, out of caution, we decided to default runOnSave to off and listen to the community for possible future improvements.


Can I set this temporarily in the top of my script?

st.set_option(‘server.runOnSave’, True)


Hi @Andrew_Holoska, thanks for the follow up. It is not possible to set server.runOnSave in the script. We have a PR to make clear which options you can set in the script: https://github.com/streamlit/streamlit/pull/702. This has been merged and will be in the next release. For now you can set in the script only: client.displayEnabled and client.caching.



1 Like