liveBook · Manning

Rerun

As explained in Build Python Web Apps with Streamlit

Always Rerun is a Streamlit development setting that automatically reruns an app whenever its source code changes.

When you are editing a Streamlit app, Always Rerun lets you save your Python file and see the updated app in the browser without clicking Rerun each time. Start the app once with `streamlit run <filename>`; you do not need to repeat that terminal command after ordinary code edits. section 2.4 section 2.5.5

Choose how you want to review changes:

  • Save the file and click Rerun when Streamlit reports that the source changed. This gives you control over when the new version appears. section 2.5.5
  • Click Always Rerun to have Streamlit update the app automatically after code changes. To turn it off, open the upper-right menu, select Settings, and uncheck Run on Save. section 2.5.5

Check a password-rule change

Add a rule requiring a numeral and edit the password-check button’s label. After saving, use Rerun or Always Rerun to see the new label and test the new rule in the browser. section 2.5.5

Always Rerun is a development setting for code changes, not a requirement for widget interactions: clicking a button or changing a selection already reruns the Python script. Automatic updates can also make it harder to spot what changed on the page. Changes to files or databases the app depends on may occasionally require stopping and restarting the app. section 2.5.5 section 4.3.2 section 2.4

How Build Python Web Apps with Streamlit covers it

How deep it goes
Explains file monitoring, the Rerun and Always Rerun controls, and how to disable automatic updates; does not detail change detection.
Examples
Uses a password checker’s new numeral rule and changed button label to demonstrate reviewing saved edits.
What it assumes
Assumes a saved Python app and shows how to launch it from the terminal before testing changes in a browser.
What you can do after
Operate/configure it by choosing Always Rerun for automatic updates or unchecking Run on Save to return to manual Rerun.
How it connects
Distinguishes updates after source-code changes from Streamlit script reruns triggered by widget interactions.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Build Python Web Apps with Streamlit. The section links point to the parts of the book it draws on.