Closed FeodorFitsner closed 1 month ago
This pull request implements a significant restructuring of the Flet packages and introduces a new flet build
v2 command. The changes include reorganizing the package structure, updating dependencies, modifying build processes, and adjusting how Flet components are imported and used across the project.
sequenceDiagram
participant User
participant CLI as flet_cli
participant Core as flet_core
participant Desktop as flet_desktop
participant Web as flet_web
User->>CLI: Run flet build
CLI->>Core: Initialize build environment
CLI->>Desktop: Prepare desktop build
CLI->>Web: Prepare web build
CLI->>CLI: Execute build commands
CLI->>User: Return build results
graph TD;
subgraph Flet
subgraph CLI
flet_cli --> flet_cli_commands
end
subgraph Core
flet_core --> flet_core_utils
end
subgraph Desktop
flet_desktop
end
subgraph Web
flet_web
end
end
flet_cli --> flet_core
flet_cli --> flet_desktop
flet_cli --> flet_web
flet_desktop --> flet_core
flet_web --> flet_core
classDiagram
class Command {
-emojis: dict
-dart_exe: Optional[str]
-verbose: bool
-build_dir: Optional[Path]
-flutter_dir: Optional[Path]
-flutter_exe: Optional[str]
-platforms: dict
-cross_platform_permissions: dict
+add_arguments(parser: argparse.ArgumentParser) void
+handle(options: argparse.Namespace) void
}
Change | Details | Files |
---|---|---|
Restructured Flet packages |
|
sdk/python/packages/flet/src/flet/app.py sdk/python/packages/flet/src/flet/security/__init__.py sdk/python/packages/flet/src/flet/utils/__init__.py sdk/python/packages/flet-core/src/flet_core/page.py sdk/python/packages/flet-cli/src/flet_cli/cli.py |
Implemented new flet build v2 command |
|
sdk/python/packages/flet-cli/src/flet_cli/commands/build.py |
Updated CI/CD pipeline |
|
.appveyor.yml ci/common.sh ci/update-flet-wheel-deps.sh ci/patch_toml_versions.py ci/patch_toml_package_name.py |
Refactored client-side code |
|
client/lib/main.dart client/pubspec.yaml client/web/index.html client/web/flutter_bootstrap.js |
Thanks for the new features :) @FeodorFitsner When can we expect a new release?
Hopefully next week.
Closes #3839 Closes #3050
Summary by Sourcery
Revamp the Flet CLI with a new package structure and introduce version 2 of the
flet build
command. Add cross-platform permissions, support for compiling Python files, and deep linking configuration. Enhance the build and CI processes to support multiple platforms and Python 3.12, and improve security utilities. Update documentation with new README files for Flet packages.New Features:
Enhancements:
Build:
CI:
Documentation:
Python 3.12
Closes #4007
Packaged Flet app runs on Python 3.12.6 runtime for all platforms.
New packages structure
Closes #3163 Closes #2637
The structure avoids rewriting pip dependencies while installing
flet
package on various platforms. There was a problem of detecting the correctflet
package to install (flet-runtime
,flet-embed
orflet-pyodide
?) ifflet
was not a direct dependency in user's app.New Flet packages.
flet
- required for minimal Flet setup, app entry point for various platforms.flet-core
- required for minimal Flet setup, core logic and controls.flet-cli
- installed on desktop only, Flet CLI.flet-desktop
- installed on desktop only. Contains pre-built Flet "client" app binary for macOS, Windows and Linux.flet-desktop-light
- installed on Linux desktop only. Contains a light-weight version of Flet "client" for Linux.flet-web
- installed on desktop only. Contains Flet web "client" and FastAPI integration.Faster re-builds
Closes #4036
Flutter app created by
flet build
command is not re-created all the time in a temp directory, but cached inbuild/flutter
directory which gives faster re-builds, improves packaging troubleshooting and does not pollute temp directory.Permissions
AndroidManifest.xml
for Android.Info.plist
for iOS.Info.plist
and*.entitlements
for macOS.iOS
No more hard-coded permissions in
Info.plist
.Setting iOS permissions:
For example:
macOS
No hard-coded entitlements in
Release.entitlements
.Setting macOS entitlements:
Default macOS entitlements:
com.apple.security.app-sandbox = False
com.apple.security.cs.allow-jit = True
com.apple.security.network.client = True
com.apple.security.network.server" = True
Android
No hard-coded permissions in
AndroidManifest.xml
.Setting Android permissions and features:
For example:
Default Android permissions:
android.permission.INTERNET
Default permissions can be disabled with
--android-permissions
option andFalse
value, for example:Default Android features:
android.software.leanback=False
(False
means it's written in manifest asandroid:required="false"
)android.hardware.touchscreen=False
Cross-platform permission groups
There are pre-defined permissions that mapped to
Info.plist
,*.entitlements
andAndroidManifest.xml
for respective platforms.Setting cross-platform permissions:
Supported permissions:
location
camera
microphone
photo_library
iOS mapping to
Info.plist
entrieslocation
NSLocationWhenInUseUsageDescription = This app uses location service when in use.
NSLocationAlwaysAndWhenInUseUsageDescription = This app uses location service.
camera
NSCameraUsageDescription = This app uses the camera to capture photos and videos.
microphone
NSMicrophoneUsageDescription = This app uses microphone to record sounds.
photo_library
NSPhotoLibraryUsageDescription = This app saves photos and videos to the photo library.
macOS mapping to entitlements
location
com.apple.security.personal-information.location = True
camera
com.apple.security.device.camera = True
microphone
com.apple.security.device.audio-input = True
photo_library
com.apple.security.personal-information.photos-library = True
Android mappings
location
android.permission.ACCESS_FINE_LOCATION": True
android.permission.ACCESS_COARSE_LOCATION": True
android.permission.ACCESS_BACKGROUND_LOCATION": True
android.hardware.location.network": False
android.hardware.location.gps": False
camera
android.permission.CAMERA": True
android.hardware.camera": False
android.hardware.camera.any": False
android.hardware.camera.front": False
android.hardware.camera.external": False
android.hardware.camera.autofocus": False
microphone
android.permission.RECORD_AUDIO": True
android.permission.WRITE_EXTERNAL_STORAGE": True
android.permission.READ_EXTERNAL_STORAGE": True
photo_library
android.permission.READ_MEDIA_VISUAL_USER_SELECTED": True
"Data" and "Temp" directories for the app
Closes #4114 Closes #2357
Flet developers have been asking where to store application data, such as uploaded files, SQLite databases, etc. that are persistent across application updates.
This release introduce two environment variables that are available in your Flet apps:
FLET_APP_DATA
- directory for storing application data that is preserved between app updates. That directory is already pre-created.FLET_APP_TEMP
- directory for temporary application files, i.e. cache. That directory is already pre-created.For example, data folder path can be read in your app as:
To make it work in development mode define those variables to suitable locations on your drive, for example:
Deep linking support
Closes #4025
There is a new
--deep-linking-url
option to configure deep linking for iOS and Android builds. The value must be in the format<sheme>://<host>
.Other features and fixes
--split-per-abi
option forflet build
command. Closes #4041packaging
dependency is relaxed. Closes #3945