Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reloading is very slow #3344

Closed
xiaoxidashen opened this issue Jul 12, 2024 · 11 comments
Closed

Reloading is very slow #3344

xiaoxidashen opened this issue Jul 12, 2024 · 11 comments
Labels
help wanted Extra attention is needed

Comments

@xiaoxidashen
Copy link

Description

when i change py file, console immediately print "WARNING: WatchFiles detected changes in 'test.py'. Reloading..." and long time later (In case of Python 3.8 ,more than 10s,In case of Python 3.12, never auto reload), console print "NiceGUI ready to go on http://localhost:8080", brower changed, nicegui 1.4.29

from nicegui import ui

ui.label('123')

ui.run(reload=True)
@xiaoxidashen
Copy link
Author

after print "WARNING: WatchFiles detected changes in 'test.py'. Reloading...",
In case of Python 3.12, only i press ctrl + F5, one second later, terminal print NiceGUI ready to go on http://localhost:8080, and brower render updated content, if i don't press ctrl + F5, can not see updated content

@xiaoxidashen
Copy link
Author

xiaoxidashen commented Jul 12, 2024

i found use command in powershell is faster rather than use button in pycharm

@python-and-novella
Copy link
Contributor

It seems to be related to the integration method of the terminal.Could you provide your terminal setting details?

@xiaoxidashen
Copy link
Author

It seems to be related to the integration method of the terminal.Could you provide your terminal setting details?

I don't have any special settings. I use pycharm to create a new project, use Virtualenv as the python environment, and the terminal is when I click on the pycharm terminal, it automatically opens the powershell terminal with (.venv) loaded.

@python-and-novella
Copy link
Contributor

It is normal for me when i run code in pychram's terminal which doesn't support Crtl + F5.
But for running it by click run button,the output console which supports Crtl + F5 is the same as you said.
After i modify run configuration,enable emulate terminal in output console,it is ok now.
Are you sure you run it in terminal? It's confused for me.

@xiaoxidashen
Copy link
Author

xiaoxidashen commented Jul 12, 2024

It is normal for me when i run code in pychram's terminal which doesn't support Crtl + F5. But for running it by click run button,the output console which supports Crtl + F5 is the same as you said. After i modify run configuration,enable emulate terminal in output console,it is ok now. Are you sure you run it in terminal? It's confused for me.

first the ctrl f5 is press in chrome brower , not pycharm
second, i derect open powershell by windows terminal, without any config, follow is log

PS D:\Code\Python\Projects\hello\tmp> ..\.venv\Scripts\activate.ps1
(.venv) PS D:\Code\Python\Projects\hello\tmp> python .\test.py
NiceGUI ready to go on http://localhost:8080
WARNING:  WatchFiles detected changes in 'test.py'. Reloading...
NiceGUI ready to go on http://localhost:8080

@python-and-novella
Copy link
Contributor

Need more details or pics or gifs, I can't reproduce your bug for now according your statement.

@xiaoxidashen
Copy link
Author

Need more details or pics or gifs, I can't reproduce your bug for now according your statement.

sorry, just create a pycharm python project, add code

from nicegui import ui
ui.label('123')
ui.run(reload=True)

then click run button, brower auto open page show above 123 lable, then change 123 to abc, and press ctrl s. you can see pycahrn print "WARNING: WatchFiles detected changes in 'test.py'. Reloading...", but brower never change anything. if you use command "python test.py" rather than click pycharm run button, you can find when you change py file , program correct auto reload in 1 second

@falkoschindler falkoschindler added the help wanted Extra attention is needed label Jul 12, 2024
@python-and-novella
Copy link
Contributor

same bug from pycharm (https://youtrack.jetbrains.com/issue/PY-63296/Pycharm-FastAPI-uvicorn-run-vs-terminal-differences-and-issue-with-slow-reloading-when-it-works).
similar bug from uvicorn (encode/uvicorn#2000).
maybe root bug from pycharm (https://youtrack.jetbrains.com/issue/PY-60962/os.killpid-signal.CRTLCEVENT-ignored-when-running-python-program-from-Pycharm)
Sovle it temporarily by enabling Emulate terminal in output console which is from https://www.cnblogs.com/aminor/p/17764109.html (it's a chinese site,there are more details about this bug.You can use google translator to translate it.)

@falkoschindler
Copy link
Contributor

As @python-and-fiction mentioned, this seems to be a PyCharm problem and we can't do much about it. Therefore I'll close this issue.

@falkoschindler falkoschindler closed this as not planned Won't fix, can't repro, duplicate, stale Jul 17, 2024
@echoflying
Copy link

I use visor, it looks have same problem. It's take much longer than streamlit.

And I also have problem descripted in issue #1480. as I changed the code the page wonn't change, Ctrl-F5 wonn't work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

4 participants