Open auphof opened 2 weeks ago
debug stepping through and comparing why it worked in the VM situation has surfaced a solution.
It is clear the difference is whether the runtime app.py
starts up a __run_socket_server
or a __run_web_server
.
The VM with a remote SSH session was starting a __run_web_server
.
It appears the __run_web_server
is required for the debugging . It also is apparent from reading the app.py
that the env FLET_FORCE_WEB_SERVER
can force the __run_web_server
.
So in both the WSL2 and the VM instances one can force the correct operation of the client using FLET_FORCE_WEB_SERVER=true poetry run flet run main.py -p 8550
.
NOTE: BE AWARE that only the window that resulted from the flutter run -d linux --debug
will get the updates from hot reloading of any dart changes after pressing the R
in that terminal session. Both Flet GUI (page) windows will get Hot reloads to main.py
This FLET_FORCE_WEB_SERVER
env var was introduced in #2700 and made it into 0.21.0. The blog entry https://flet.dev/blog/flet-fastapi-and-async-api-improvements do note this env var FLET_FORCE_WEB_SERVER
with others in the major change of from fletd
. This blog could possibly do with explanation for it's use in debugging or development of the Flet Client and extensions. I am not totally clear of its ramifications
I think with clarification in documentation this usage fix is acceptable for now as one can work with it.
However for the backlog a simpler debug configuration with reduction of the 2 Flet GUI pages to 1 may be worth considering. This together with the noisy log in flet/client with flutter run -d linux --debug -v
hammering with failed connections to the ws server at ws://localhost:8550/ws....
may be worth transferring to Feature request
Description
I believe there is an issue when building the
flet/client
for debugging the flet client. It particularly makes it very difficult for further flutter module development in a Linux WSL2 distro. This issue has been discussed in #2535 where I thought I was just lacking documentation and now I wish to document my understanding of the issue and assist resolving,NOTE in the additional information I was able to get a VM based instance to build and operate as intended but required a remote ssh session from the VM host to the VM. whilst this could enable current development requirements I believe it should work in the WSL2 instance for general use and simple IDE operation ( please see additional information below)
Code and method example to reproduce the issue:
DEBUG build
flutter run-d linux --debug
in terminal 1sdk/python/playground
export FLET_VIEW_PATH=$HOME/dev/SANDBOX/SANDBOX-flet/modules/flet/client/build/linux/x64/debug/bundle
poetry run flet run main.py -p 8550
In contrast, if I build the client with the profiling profile
PROFILING build
flutter run -d linux --profile
in terminal 1sdk/python/playground
export FLET_VIEW_PATH=$HOME/dev/SANDBOX/SANDBOX-flet/modules/flet/client/build/linux/x64/profile/bundle
poetry run flet run main.py -p 8550
the very simple
main.py
page definition is in theflet/sdk/python/playground
and reads as followsDescribe the results you received: see above
Describe the results you expected:
I expect in the WSL2 environment that the page presented in Linux GDI should be drawn and have the hot reloading working for debugging the flutter module integration when using the debug build of a Flet client.
Additional information you deem important (e.g. issue happens only occasionally):
In the logging in terminal 2 i have noticed a slight difference in the socket connection The line
flutter: Connected to: 127.0.0.1:8550
does not appear in the attempt to run the debugging buildin the case of the profiling build
and in the case of the debugging build
additionally I setup a virtual box vm with ubuntu22.04 desktop and have had the same issue, except with 1 working solution If i ssh into the vm and execute the following it works
export FLET_VIEW_PATH=$HOME/dev/SANDBOX/SANDBOX-flet/modules/flet/client/build/linux/x64/debug/bundle
poetry run flet run main.py -p 8550
flutter run --debug
) also updates. Both pages draw identicallyFlet version (
pip show flet
):Give your
requirements.txt
file (don'tpip freeze
, instead give direct packages):Operating system:
WSL2 ubuntu 22.04 distro on Windows 11
Additional environment details: