Open torablien opened 1 week ago
Notably, this doesn't seem to fail if you just do Vector = list[float]
instead of type Vector = list[float]
(with the type
statement). Python docs explicitly say to use the a type operator here but this workaround seems to work.
This happens because type
was introduced in Python 3.12, but when packaging an app atm, Py3.11.6 is used by Flet(serious-python) instead.
Upgrade to a higher Py version will happen through serious-python.
Thanks, that's helpful and also explains why I am running into various other SyntaxError issues like with @override
which was also introduced in 3.12.
As a suggestion, maybe the build command can provide a warning if the current Python version is > than the one used in packaging?
As a suggestion, maybe the build command can provide a warning if the current Python version is > than the one used in packaging?
Nice suggestion.
Is there anything I could do to help upgrade serious-python to Python 3.12.3+? I'd gladly submit a PR because I need this.
This may be addressed by https://github.com/flet-dev/serious-python/pull/109.
There are number of dependent PRs in Kivy/kivy-ios and python-for-android that need to be tested, merged, and added to serious-python in order to unblock this.
Duplicate Check
Describe the bug
When packaging a Flet app (e.g. via
flet build macos
), type aliases seem to cause build failures (but works fine when running withflet run
). On smaller applications, this is flagged in verbose mode as a syntax error, but in larger applications (seemingly defined as ones with many dependencies even if no real logic), this fails opaquely.Example error in smaller application:
Example error in larger application:
Code sample
Running
flet build macos -vv
on simple Hello World app.Failing:
Works:
Both work when running via
flet run
The only difference between smaller vs larger app re the missing error logs is the amount of requirements in requirements.txt. Small app has few to no requirements where the large app has many (even though the app remains just hello world).
To reproduce
Run
flet create hello_world
and add a type alias declaration to main.py (or any file). Then runflet build macos -vv
.Operating System
macOS - M1 Pro
Operating system details
Sonoma 14.5
Flet version
0.24.1
Python version
Running Python 3.12.3
Regression
I'm not sure / I don't know