question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Hot-reloading not working

See original GitHub issue

Hi, I think I’m hitting this again https://github.com/streamlit/streamlit/issues/358 I did not investigate why the fix https://github.com/streamlit/streamlit/pull/537 doesn’t work

System

Streamlit: version 0.51.0
Description:    Manjaro Linux
Release:        18.1.3

Using streamlit remotely with ssh port forwarding

Steps to reproduce:

Files

project/demo/demo.py

import streamlit as st
from mytest import fun

st.info(fun())

project/src/mytest.py

def fun():
    return 2

Execute

cd project
export PYTHONPATH="${PYTHONPATH}:src/"
streamlit run demo/demo.py

Problem

Changing the return value of fun() in src/mytest.py doesn’t change the output in streamlit.

Neither by modifying src/mytest.py and saving it (this would be cool), modifying demo/demo.py and saving it, pressing Run again nor Clear cache

Workaround

Closing and restart the streamlit server.

Maybe related

I have problems making streamlit recognize newly installed python packages, I have to restart the server.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:1
  • Comments:7 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
monchiercommented, Dec 13, 2019

Would it work if we had nested python packages, e.g. src/mypackage/mytest.py, but only src in the PYTHONPATH?

We will allow anything prefixed by an element in the PYTHONPATH, so it should work. I think we should consider that the individual paths specified in the PYTHONPATH can be absolute paths or paths that are relative to the current working directory.

Please consider adding to the watcher all the python files *.py recursively from the working directory from which streamlit is launched.

This was debated some time back and we decided against it. We choose instead to include everything that was contained in the directory of the main python script. The reasoning behind that is that you have less control on what it is in your current working directory. That said, I’ll bring it up again internally. We can also add more configurability. The PYTHONPATH itself allows for easily get around this and seems a reasonable solution to me. Given that the PYTHONPATH can be relative, by adding . to the PYTHONPATH you would allow anything contained in the current working directory recursively.

1reaction
lucmoscommented, Dec 11, 2019

Hi,

Would it work if we had nested python packages, e.g. src/mypackage/mytest.py, but only src in the PYTHONPATH?

Please consider adding to the watcher all the python files *.py recursively from the working directory from which streamlit is launched. So in in this examples I’d like to watch all the file that match project/**/*.py.

As an additional benefit, in this way it should work even with configurations that don’t make use of the PYTHONPATH env variable, but use the os package to change paths.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Hot Reload is not working in my React App - Stack Overflow
Hot Reload is not working in my React App · This does happen sometimes. Do npm install and try adding some code. ·...
Read more >
Hot reload not working - Visual Studio Feedback
I'm trying to use Hot Reload on Android Emulador, but when I do any change in XAML file, the app doesn't update. Looking...
Read more >
Hot Reload stopped working with React "^17.0.1" · Issue #9904
Describe the bug Hot reloading when the redux-state change stopped working when I use CRA to get the last React version.
Read more >
Troubleshooting XAML Hot Reload - Visual Studio (Windows)
If Hot Reload is not available · Verify that XAML Hot Reload is enabled · Verify that you use Start Debugging rather than...
Read more >
Hot Reload not working in React 17.0.3 - Code with Mosh Forum
Hi, I have recently created a new project with create-react-app. Also, I am following Mosh's Mastering React course and according to it, ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found