-
Notifications
You must be signed in to change notification settings - Fork 484
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
FastAPI instead of built-in Fletd server. Mixed async/sync apps. #2700
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
commit fd2e80788e27cd022fce509b5499d1951630e4a9 Author: Feodor Fitsner <feodor@appveyor.com> Date: Fri Feb 23 09:38:59 2024 -0800 Removed blocking decorator commit 7d1f925392f63a85a7f60fcb07afa3374cb565b5 Author: Feodor Fitsner <feodor@appveyor.com> Date: Fri Feb 23 09:25:56 2024 -0800 Added pool to app manager
commit 08b9ab0 Author: Feodor Fitsner <feodor@appveyor.com> Date: Sun Feb 25 14:31:56 2024 -0800 invoke_method() refactored commit 9a1e37c Author: Feodor Fitsner <feodor@appveyor.com> Date: Sun Feb 25 13:55:18 2024 -0800 `Control._is_isolated()` replaced with `Control.is_isolated()` Close #2721 commit 1a3d82d Author: Feodor Fitsner <feodor@appveyor.com> Date: Sun Feb 25 13:14:33 2024 -0800 Fix deps for tests commit 4f8326c Author: Feodor Fitsner <feodor@appveyor.com> Date: Sun Feb 25 13:11:05 2024 -0800 `Control. _before_build_command()` renamed to `Control.before_update()` commit 80a2ab0 Author: Feodor Fitsner <feodor@appveyor.com> Date: Sun Feb 25 13:06:32 2024 -0800 Deprecate controls' async methods commit 77f7989 Author: Feodor Fitsner <feodor@appveyor.com> Date: Sat Feb 24 18:34:13 2024 -0800 async methods from connection removed commit d7edea0 Author: Feodor Fitsner <feodor@appveyor.com> Date: Fri Feb 23 14:24:52 2024 -0800 `page.go` re-worked, EventHandler re-worked commit 679144d Author: Feodor Fitsner <feodor@appveyor.com> Date: Fri Feb 23 13:17:18 2024 -0800 PubSubHub moved to flet_core commit 5103072 Author: Feodor Fitsner <feodor@appveyor.com> Date: Fri Feb 23 12:51:51 2024 -0800 PubSub sync and some async page functions removed
zrr1999
pushed a commit
to zrr1999/flet
that referenced
this pull request
Jul 17, 2024
…t-dev#2700) * FastAPI to support sync event handlers * FastAPI to run sync handlers on a threadpool * flet_fastapi package moved into flet * flet_fastapi renamed to flet.fastapi. Utils refactored. * Async server only - almost working. No threadpool shutdown. * Use FastAPI instead of built-in web server * Remove Fletd from builds * Build Flet for web * Remove async_lock, fix CI * Use url_host and host * Switch page between flet app instances * Fix getWebsocketEndpointPath() for desktop * Handle all flet run cases * FLET env vars re-worked * Cleanup * Running apps in external ASGI server * Correct handling of assets dir * Update poetry.lock * FLET_UPLOAD_SECRET_KEY renamed back to FLET_SECRET_KEY * opt_in_blocking, refactor flet_core.utils * Squashed commit of the following: commit fd2e80788e27cd022fce509b5499d1951630e4a9 Author: Feodor Fitsner <feodor@appveyor.com> Date: Fri Feb 23 09:38:59 2024 -0800 Removed blocking decorator commit 7d1f925392f63a85a7f60fcb07afa3374cb565b5 Author: Feodor Fitsner <feodor@appveyor.com> Date: Fri Feb 23 09:25:56 2024 -0800 Added pool to app manager * Squashed commit of the following: commit 08b9ab0 Author: Feodor Fitsner <feodor@appveyor.com> Date: Sun Feb 25 14:31:56 2024 -0800 invoke_method() refactored commit 9a1e37c Author: Feodor Fitsner <feodor@appveyor.com> Date: Sun Feb 25 13:55:18 2024 -0800 `Control._is_isolated()` replaced with `Control.is_isolated()` Close flet-dev#2721 commit 1a3d82d Author: Feodor Fitsner <feodor@appveyor.com> Date: Sun Feb 25 13:14:33 2024 -0800 Fix deps for tests commit 4f8326c Author: Feodor Fitsner <feodor@appveyor.com> Date: Sun Feb 25 13:11:05 2024 -0800 `Control. _before_build_command()` renamed to `Control.before_update()` commit 80a2ab0 Author: Feodor Fitsner <feodor@appveyor.com> Date: Sun Feb 25 13:06:32 2024 -0800 Deprecate controls' async methods commit 77f7989 Author: Feodor Fitsner <feodor@appveyor.com> Date: Sat Feb 24 18:34:13 2024 -0800 async methods from connection removed commit d7edea0 Author: Feodor Fitsner <feodor@appveyor.com> Date: Fri Feb 23 14:24:52 2024 -0800 `page.go` re-worked, EventHandler re-worked commit 679144d Author: Feodor Fitsner <feodor@appveyor.com> Date: Fri Feb 23 13:17:18 2024 -0800 PubSubHub moved to flet_core commit 5103072 Author: Feodor Fitsner <feodor@appveyor.com> Date: Fri Feb 23 12:51:51 2024 -0800 PubSub sync and some async page functions removed * `warn()` replaced with `@deprecated` * Make OAuth working in a new arch * Fix deprecation * Customize web app endpoints via env vars * Renamed `PageMediaChangeEvent` to `PageMediaData` * Renamed `run_in_thread` to `run_thread` * Deprecate some Video methods * Fix Video.__playlist * Small fixes with loops * Cleanup * Switch to our own `@deprecated` decorator * Update deprecated message.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
_async
methods in the most cases.page.run_thread()
andpage.run_task()
andpage.executor
andpage.loop
.Run with Hypercorn:
API changes
import flet_fastapi
withimport flet.fastapi as flet_fastapi
.ft.app(export_asgi_app)
. Howassets
,upload
folders are resolved?Control.did_mount_async()
andControl.will_unmount_async()
are not called anymore. UseControl.did_mount()
andControl.will_unmount()
instead..update()
and.add()
in both sync and async handlers.Control._before_build_command()
replaced withControl.before_update()
.Control._is_isolated()
replaced withControl.is_isolated()
./api/oauth/redirect
to/oauth_callback
. UseFLET_OAUTH_CALLBACK_HANDLER_ENDPOINT
env var to customize.Deprecated methods
Audio.pause_async
Audio.play_async
Audio.release_async
Audio.resume_async
Audio.seek_async
AudioRecorder.pause_recording_async
AudioRecorder.resume_recording_async
AudioRecorder.start_recording_async
Canvas.clean_async
Column.clean_async
DatePicker.pick_date_async
Dismissible.confirm_dismiss_async
Dropdown.focus_async
ElevatedButton.focus_async
FilePicker.get_directory_path_async
FilePicker.pick_files_async
FilePicker.save_file_async
FilePicker.upload_async
GridView.clean_async
HapticFeedback.heavy_impact_async
HapticFeedback.light_impact_async
HapticFeedback.medium_impact_async
HapticFeedback.vibrate_async
IconButton.focus_async
ListView.clean_async
MenuItemButton.focus_async
OutlinedButton.focus_async
Page.add_async
Page.clean_async
Page.close_banner_async
Page.close_bottom_sheet_async
Page.close_dialog_async
Page.close_drawer_async
Page.close_end_drawer_async
Page.close_in_app_web_view_async
Page.error_async
Page.get_upload_url_async
Page.go_async
Page.insert_async
Page.launch_url_async
Page.logout_async
Page.remove_async
Page.remove_at_async
Page.scroll_to_async
Page.set_clipboard_async
Page.show_banner_async
Page.show_bottom_sheet_async
Page.show_dialog_async
Page.show_drawer_async
Page.show_end_drawer_async
Page.show_snack_bar_async
Page.update_async
Page.window_center_async
Page.window_close_async
Page.window_destroy_async
Page.window_to_front_async
Pagelet.close_drawer_async
Pagelet.close_end_drawer_async
Pagelet.show_drawer_async
Pagelet.show_end_drawer_async
PubSub.send_all_async
PubSub.send_all_on_topic_async
PubSub.send_others_async
PubSub.send_others_on_topic_async
PubSub.subscribe_async
PubSub.subscribe_topic_async
PubSub.unsubscribe_all_async
PubSub.unsubscribe_async
PubSub.unsubscribe_topic_async
ResponsiveRow.clean_async
Row.clean_async
ScrollableControl.scroll_to_async
SearchBar.close_view_async
SearchBar.open_view_async
SubmenuButton.focus_async
TextButton.focus_async
TextField.focus_async
TimePicker.pick_time_async
Video.next_async
Video.pause_async
Video.play_async
Video.play_or_pause_async
Video.playlist_add_async
Video.playlist_remove_async
Video.previous_async
Video.stop_async
Environment variables
FLET_FORCE_WEB_SERVER
FLET_SERVER_PORT
-8000
is program is run on a Linux server orFLET_FORCE_WEB_SERVER
is set; otherwise random port.FLET_SERVER_IP
, bounds to all server IPs by default.FLET_ASSETS_DIR
FLET_UPLOAD_DIR
FLET_MAX_UPLOAD_SIZE
, bytes. Unlimited if not specified.FLET_SECRET_KEY
- for uploadsFLET_WEB_APP_PATH
FLET_SESSION_TIMEOUT
, seconds. Default is3600
.FLET_OAUTH_STATE_TIMEOUT
, seconds. Default is600
.FLET_WEB_RENDERER
-canvaskit
(default),html
orauto
.FLET_WEB_USE_COLOR_EMOJI
.true
, orTrue
or1
.FLET_WEB_ROUTE_URL_STRATEGY
-path
(default) orhash
.FLET_WEBSOCKET_HANDLER_ENDPOINT
- default/ws
.FLET_UPLOAD_HANDLER_ENDPOINT
- default/upload
.FLET_OAUTH_CALLBACK_HANDLER_ENDPOINT
- default/oauth_callback
.Sync countdown example
Async countdown example