-
Notifications
You must be signed in to change notification settings - Fork 4k
Description
Summary
If a python file a.py imports a module b which imports c, then changnes to c don't hot-reload properly to update a.
Steps to reproduce
In essence we will setup an import chain a -> b -> c where
aprintsb.xandb.yb.xis defined directly inbb.yis defined asc.foo
Thus a depends on b directly and c "deeply" (step 1). Updating the direct import (step 2) works properly, but updating the deep import (step 3) fails. As a sanity check, restarting the server (step 4) displays the correct output.
Step 1: Setup the import chain (THIS WORKS)
We will setup the import chain a -> b -> c by defining these three files:
a.py:
import streamlit as st
import b
st.write('b.x:', b.x, 'b.y:', b.y)b.py:
import c
x = 41
y = c.fooc.py:
foo = 33When we streamlit run a.py we see the correct output:
Step 2: Update the imported module b (THIS WORKS)
Without closing the server created in step 1, update b.py as follows:
import c
x = 42
y = c.fooThis change is hot-reloaded and again we see the correct output:
Step 3: Update the deeply imported module c (THIS DOESN'T WORK!!)
Again without closing the server, update c.py as follows:
foo = 34This change is hot-reloaded but we do not see the correct output:
Step 4: Demonstrate the correct ouput by killing and restarting the server.
Kill the server and run it again (streamlit run a.py) and you will see the correct output:
Behavior
Actual behavior
Described above.
Expected behavior
Changing a deeply imported module (c) should correctly update everything.
In other words, we should see the step 4 output after step 3.
Is this a regression?
Probably not.
Debug info
$ streamlit version && python --version && pyenv --version && sw_vers && "/Applications/Google Chrome.app/Contents/MacOS/Google Chrome" --version
Streamlit, version 0.47.4
Python 3.6.3
pyenv 1.2.3
ProductName: Mac OS X
ProductVersion: 10.14.6
BuildVersion: 18G103
Google Chrome 77.0.3865.90
Additional information
This is the second of two bugs based on this awesome-streamlit issue. The first bug is this.



