Skip to main content

16 posts tagged with "releases"

View All Tags

Flet v0.25.0 Release Announcement

· 10 min read
Feodor Fitsner
Flet founder and developer

Hey Flet developers, we’ve got something exciting to share — Flet 0.25.0 is officially released!

The biggest news? No more Kivy for iOS and Android packaging. No more dealing with frustrating Python binary dependencies — Flet now uses its own custom Python runtime, so your app builds are easier than ever. Plus, we’ve added loads of new features like better permissions control, faster rebuilds, and even a lightweight Linux client that skips the bloat.

Let’s dive into all the cool stuff Flet 0.25.0 has to offer! 🚀

How to upgrade

Run the following command to upgrade Flet:

pip install 'flet[all]' --upgrade
note

[all] is an "extra" specifier which tells pip to install all flet package dependencies. See New Python packages structure section below for the explanation.

Bump flet package version to 0.25.0 (or remove it at all to use the latest) in requirements.txt or pyproject.toml.

New packaging

Flet packaging for iOS and Android has been relying on Kivy and it was super annoying when your app depends on Python binary packages, such as Numpy or Pillow. You needed to compile those packages yourself using Kivy command line tools. It was really frustrating and even hopeless if Kivy didn't have "recipes" for some packages, like Pydantic.

Flet does not depend on Kivy anymore and uses its own Python runtime "meticulously crafted in-house".

Flet packaging implementation for iOS and Androind adheres to strict specifications defined in PEP 730 (iOS) and PEP 738 (Android) which were implemented and released in Python 3.13 (and back-ported to Python 3.12). When pypi.org supports wheel tags for iOS and Android and 3rd-party Python package maintainers start uploading their mobile packages Flet will be compatible with them and you'll be able to use them in your Flet app.

Pre-built binary packages

flet build command for iOS and Android is now installing pre-built binary packages from https://pypi.flet.dev.

New packages can be built with creating a recipe in Mobile Forge project. For now, Flet team is authoring those recipes for you, but when the process is polished and fully-automated you'll be able to send a PR and test the compiled package right away.

If you don't yet see a package you require at https://pypi.flet.dev, you can request it in Flet discussions - Packages. Please do not request pure Python packages. Go to package's "Download files" section at https://pypi.org and make sure it contains binary platform-specific wheels.

Packaging behavior was changed too:

  • The packaging is not trying to replace flet dependency with flet-runtime, flet-embed or flet-pyodide, but install all dependencies "as is" from requirements.txt or pyproject.toml - thanks to the new Flet packages structure.
  • If the binary package for target platform is not found the packaging won't be trying to compile it from source distribution, but will fail instead with a meaningful error.

Python 3.12

Packaged Flet app runs on Python 3.12.7 runtime on all platforms.

Permissions

New flet build command allows granular control over permissions, features and entitlements embedded into AndroidManifest.xml, Info.plist and .entitlements files.

No more hard-coded permissions in those files!

For example, setting permissions for iOS bundle:

flet build --info-plist NSLocationWhenInUseUsageDescription="This app uses location service when in use."

or the same in pyproject.toml (read about pyproject.toml support below):

[tool.flet.ios.info] # --info-plist
NSLocationWhenInUseUsageDescription = "This app uses location service when in use."

An example of setting Android permissions and features:

flet build \
--android-permissions android.permission.READ_EXTERNAL_STORAGE=True \
android.permission.WRITE_EXTERNAL_STORAGE=True \
--android-features android.hardware.location.network=False

Read more about permissions in the docs.

Control over app compilation and cleanup

flet build command is no longer compiling app .py files into .pyc by default which allows you to defer discovery of any syntax errors in your app and complete the packaging.

You can control the compilation and cleanup with the following new options:

  • --compile-app - compile app's .py files.
  • --compile-packages - compile installed packages' .py files.
  • --cleanup-on-compile - remove unnecessary files upon successful compilation.

Signing Android bundles

We also added new options for signing Android builds:

  • --android-signing-key-store - path to an upload keystore .jks file for Android apps.
  • --android-signing-key-store-password - Android signing store password.
  • --android-signing-key-alias - Android signing key alias. Default is "upload".
  • --android-signing-key-password - Android signing key password.

Read Build and release an Android app for more information on how to configure upload key for Android builds.

Deep linking configuration

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>.

Faster re-builds

Ephemeral Flutter app created by flet build command is no longer being re-created on every build in a temp directory, but cached in build/flutter directory which gives faster re-builds, improves packaging troubleshooting and does not pollute user temp directory.

You can use --clear-cache option to do a clean build though.

Split APKs per ABI

flet build now provides the built-in --split-per-abi option to split the APKs per ABIs.

"Data" and "Temp" directories for the app

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_STORAGE_DATA - directory for storing application data that is preserved between app updates. That directory is already pre-created and its location depends on the platform the app is running on.
  • FLET_APP_STORAGE_TEMP - directory for temporary application files, i.e. cache. That directory is already pre-created and its location depends on the platform the app is running on.

For example, data folder path can be read in your app as:

import os

# it's `None` when running the app in web mode
data_dir = os.getenv("FLET_APP_STORAGE_DATA")
note

flet run command creates data and temp directories and sets FLET_APP_STORAGE_DATA and FLET_APP_STORAGE_TEMP to their paths.

pyproject.toml support

It's inconvenient and bulky to carry all flet build settings as command line options.

In Flet 0.25.0 release is now possible to configure flet build, flet run, and flet publish settings in pyproject.toml!

Flet adds tool.flet section and sub-sections to pyproject.toml. Here's the minimal version of pyproject.toml you can put into root folder of your app:

[project]
name = "my_app"
version = "1.0.0"
description = "My first Flet project"
authors = [
{name = "John Smith", email = "[email protected]"}
]
dependencies = ["flet"]

You can also generate a starting pyproject.toml (and other files) for your project with flet create command.

New Python packages structure

We re-factored Flet Python packages and removed flet-core, flet-runtime, flet-embed orflet-pyodide packages.

The new structure avoids rewriting pip dependencies while installing flet package on various platforms. There was a problem of detecting the correct flet package to install (flet-runtime, flet-embed orflet-pyodide?) if flet was not a direct dependency in user's app.

New Flet packages:

  • flet - required for minimal Flet setup, app entry point for various platforms with core logic and controls. Installed on all platforms.
  • flet-cli - contains Flet CLI commands. Installed on desktop only.
  • flet-desktop - contains pre-built Flet "client" app binary for macOS, Windows and Linux. By default installed on macOS and Windows desktops only.
  • flet-desktop-light - contains a light-weight version (without Audio and Video controls) of Flet "client" for Linux. By default installed on Linux desktops only.
  • flet-web - contains Flet web "client" and FastAPI integration. Installed on desktop only.

Packaged Flet app contains only flet package now.

flet package extras

flet package defines the following extras that can be specified when installing Flet with pip, uv, poetry and other package manager:

  • flet[all] - installs flet, flet-cli, flet-desktop and flet-web. Recommended for development.
  • flet[cli] - installs flet and flet-cli. Can be used in CI environment for packaging only.
  • flet[web] - installs flet and flet-web. Used for deploying Flet web apps.
  • flet[desktop] - installs flet and flet-desktop. Used for desktop-only development.

New Flet install and upgrade commands

Starting from this release the development version of flet package should be installed with the following command:

pip install 'flet[all]'

Ugrading flet package:

pip install 'flet[all]' --upgrade
note

pip install flet still works too, but it will install flet package only and dependent packages will be installed on demand. For example, when you run any flet CLI command flet-cli will be installed, or when you run flet run command flet-desktop package will be installed.

"Light" client for Linux

A lightweight desktop client, without Audio and Video controls, is now installed on Linux by default. It improves initial user experience as user doesn't need to immediately deal with gstreamer (audio) and mpv (video) dependencies and Flet "just works".

Once user got some Flet experience and wants to use Video and Audio controls in their application they can install gstreamer and/or mpv and replace Flet desktop with a full version.

Uninstall "light" Flet client:

pip uninstall flet-desktop-light --yes

Install full Flet desktop client:

pip install flet-desktop

New controls

  • Mobile Ads (Banner and Interstitial) (details and example).
  • Button control (#4265) - which is just an alias for ElevatedButton control.

Breaking changes

  • Refactor Badge Control to a Dataclass; added new badge property to all controls (#4077).

Below is how to migrate:

# before
page.navigation_bar = ft.NavigationBar(
destinations=[
ft.NavigationBarDestination(
icon_content=ft.Badge(
content=ft.Icon(ft.Icons.PHONE),
text=10,
),
label="Calls",
),
]
)

# after
page.navigation_bar = ft.NavigationBar(
destinations=[
ft.NavigationBarDestination(
icon=ft.Icon(
ft.Icons.PHONE,
badge="10",
),
label="Calls",
),
]
)

Other changes

  • Added {value_length}, {max_length}, and {symbols_left} placeholders to TextField.counter_text (#4403).
  • Added --skip-flutter-doctor to build cli command (#4388).
  • WebView enhancements (#4018).
  • Map control enhancements (#3994).
  • Exposed more Theme props (#4278, #4278).
  • Exposed more properties in multiple Controls (#4105)
  • Added __contains__ methods in container-alike Controls (#4374).
  • Added a custom Markdown code theme (#4343).
  • Added barrier_color prop to dialogs (#4236).
  • Merged icon and icon_content props into icon: str | Control (#4305).
  • Migrated colors and icons variables to Enums (#4180).
  • TextField: suffix_icon, prefix_icon and icon can be Control or str (#4173).
  • Added --pyinstaller-build-args to flet pack CLI command (#4187).
  • Made SearchBar's view height adjustable; added new properties (#4039).
  • Bumped Rive version and fixed Linux app build template for rive_common.

Bug fixes

  • Fixed Icon rotation (#4384).
  • Fixed regression in Markdown.code_theme when using MarkdownCodeTheme enum (#4373).
  • Fixed Segment and NavigationBarDestination accept only string tooltips (#4326).
  • Display informative message when date has wrong format (#4019).
  • Fixed MapConfiguration.interaction_configuration is not honoured (#3976).
  • Fixed Video.jump_to() fails with negative indexes (#4294).
  • Fixed condition in AppBar.tooltip_opacity (#4280).
  • Fixed wrong type (asyncio.Future -> concurrent.futures.Future) and handle CancelledError (#4268).
  • Fixed clicking on CupertinoContextMenuAction doesn't close context menu (#3948).
  • Fixed dropdown max_menu_height (#3974).
  • Fixed prevent button style from being modified in before_update() (#4181).
  • Fixed disabling filled buttons is not visually respected (#4090).
  • when label is set, use MainAxisSize.min for the Row (#3998).
  • Fixed NavigationBarDestination.disabled has no visual effect (#4073).
  • Fixed autofill in CupertinoTextField (#4103).
  • Linechart: jsonDecode tooltip before displaying (#4069).
  • Fixed button's bgcolor, color and elevation (#4126).
  • Fixed scrolling issues on Windows (#4145).
  • Skip running flutter doctor on windows if no_rich_output is True (#4108).
  • Fixed TextField freezes on Linux Mint #4422](https://github.com/flet-dev/flet/pull/4422)).

Conclusion

Flet 0.25.0 is a huge release and your feedback is highly welcomed!

Upgrade to Flet 0.25.0, test your apps and let us know how you find the new features we added.

If you have any questions, please join Flet Discord server or create a new thread on Flet GitHub discussions.

Happy Flet-ing! 👾

Flet v0.24.0 Release Announcement

· 6 min read
Henri Ndonko
Flet Contributor and Maintainer

I am very happy to announce the release of Flet version 0.24.0! It comes with a very long list of bug fixes, several enhancements and new features.

New Controls

New Properties

  • AudioRecorder: cancel_recording()
  • Video: on_completed, on_track_changed
  • InputFilter: unicode, case_sensitive, dot_all, multiline
  • Geolocator: on_error, on_position_change
  • Barchart, LineChart: tooltip_border_side, tooltip_direction, tooltip_fit_inside_horizontally, tooltip_fit_inside_vertically, tooltip_horizontal_offset, tooltip_margin, tooltip_max_content_width, tooltip_padding, tooltip_rounded_radius, tooltip_rotate_angle
  • Container: decoration, foreground_decoration, ignore_interactions, image
  • Page, View: decoration, foreground_decoration
  • CupertinoTextField: enable_scribble, image, obscuring_character, padding, scroll_padding, on_click
  • DataTable: heading_row_alignment
  • TextField: counter, disabled_hint_content, options_fill_horizontally
  • ExpansionTile: min_tile_height, show_trailing_icon
  • Markdown: fit_content, img_error_content, md_style_sheet, shrink_wrap, soft_line_break, on_selection_change
  • MenuItemButton: autofocus, overflow_axis, semantic_label
  • Tabs: label_padding, label_text_style, padding, splash_border_radius, unselected_label_text_style, on_click
  • and lot of new classes (enums, dataclasses, events)…

Enhancements

  • Better string output of Events when printed
  • Image.filter_quality now has a default of FilterQuality.MEDIUM (previously FilterQuality.LOW), which is a better default for downscaled images.
  • Geolocator control has been improved to support location streaming through the newly added on_position_change event. When defined, you will be able to "listen" to location changes as they happen.
  • When AppBar.adaptive=True and the app is running on an Apple platform, the AppBar.actions controls are now wrapped in a Row, then displayed. Before this, only the first item of AppBar.actions list was displayed.
  • The Markdown control has been significantly improved. It can now display SVG images and be much more customized.
  • A very requested feature was the ability to set a background image or gradient for the application. In #3820, we made this possible and easy to use.
  • rtl (right-to-left) property has been added to more controls (NavigationRailDestination, NavigationRail, AppBar, CupertinoAppBar, and NavigationDrawer ) to improve support for right-to-left text directions.
  • Introduced --no-rich-output flag (only in flet build command for now) to make it possible to disable rich output (mainly emojis) in the console. More information in #3708.
  • Typing has been significantly improved, particularly for event-handler properties. In modern IDEs like PyCharm and VSCode, you can now easily determine the type of an event handler's argument by simply hovering over the event in the control. Additionally, the IDE will highlight errors when you attempt to access a non-existent property on the event handler argument, ensuring more robust and error-free code.

Bug Fixes

The below issues were successfully fixed:

  • #3769: InputFilter clears the TextField text content when an invalid character is entered
  • #3770: Theme.floating_action_button_theme non existent
  • #3734: Ensure Dropdown.alignment is respected.
  • #3730: UnicodeEncodeError raised when packaging on WindowOS
  • #2160: Markdown control can't render svg images
  • #2158: Markdown broken when an image is not found
  • #3679: Broken Dismissible
  • #3670: Switch.height and Switch.width not respected
  • #3612, #3566: Broken OnScrollEvent
  • #3564: Broken TextField.capitalization
  • #3649: CupertinoPicker jumps-scroll on some platforms
  • #3557: Impeller causes blank screen on mac Intel
  • #3574: Geolocator not working on Android devices
  • #3505: WindowEventType doesn't contain fullscreen all events

Thanks to all those who reported them!

Deprecations

All deprecated items from this release will be removed in version 0.27.0.

  • ThemeVisualDensity is deprecated and has been renamed to VisualDensity
  • CupertinoButton: disabled_color is deprecated and has been renamed to disabled_bgcolor, which better reflects its use
  • Markdown: code_style is deprecated and should now be accessed as code_style_sheet.code_text_style
  • Container: image_fit, image_opacity, image_repeat, image_src and image_src_base64 are deprecated and should now be accessed from image which is of type DecorationImage

Breaking Changes and Migration

Tooltip

The Tooltip class is no more a Flet control and is from now on a simple Python dataclass. The tooltip property (available in almost all controls) now supports both strings and Tooltip objects.

Below is how to migrate:

# before
page.add(
ft.Tooltip(
message="This is tooltip",
content=ft.Text("Hover to see tooltip"),
padding=20,
border_radius=10,
)
)

# after
page.add(
ft.Text(
"Hover to see tooltip",
tooltip=ft.Tooltip(
message="This is tooltip",
padding=20,
border_radius=10,
)
)
)

TextField InputFilter

We modified how InputFilter.regex_string is internally handled. As a result of this, you (might) now have to anchor your regex pattern. This simply implies using start (^) and end ($) regex anchors. For example: r"[0-9]" now becomes r"^[0-9]$". Using this new string will lead work as expected and only numbers/digits will be allowed, but you might notice another issue: the last character of the text field cannot be deleted. To resolve this, you need to add an asterisk (*) in the regex which in this case will simply mean "match zero or more digits (including an empty string)". The new regex now becomes r"^[0-9]*$". To ease this migration, you can use an AI tool with the following simple prompt: "update the following regex pattern: #### ensuring that the entire string matches the pattern and it allows for an empty string".

Event-Handler subscription

The possibility to "subscribe" more than one callback to an event handler has been removed, as this was somehow biased (was only possible on some, and not all). Below is a simple example:

import flet as ft

def main(page: ft.Page):
def print_one(e):
print("1")
def print_two(e):
print("2")
def print_three(e):
print("3")
c = ft.Container(
bgcolor=ft.Colors.random_color(),
width=300,
height=300,
)

# subscribe callbacks
c.on_tap_down = print_one
c.on_tap_down = print_two
c.on_tap_down = print_three
page.add(c)

ft.app(main)

In the above code, we subscribe multiple callbacks to the Container.on_tap_down event. Prior to Flet version 0.24.0, running this code and tapping on the Container, you will see all the callbacks getting called ("1", "2" and "3" are printed out). From Flet version 0.24.0 going forward, one event = one callback. Meaning only the lastly subscribed callback will get executed ("3" is printed out) So, if you still want the final output to resemble the first one you can simply create one callback which calls the others:


def main(page: ft.Page):
#....

def print_all(e):
print_one(e)
print_two(e)
print_three(e)

c = ft.Container(
bgcolor=ft.Colors.random_color(),
width=300,
height=300,
on_tap_down=print_all,
)

# OR
c.on_tap_down = print_all

Conclusion

As you can see, we made a lot of changes in this release and as usual, your feedback is highly welcomed!

Upgrade to Flet 0.24.0, test your apps and let us know how you find the new features we added. If you have any questions, please join Flet Discord server or create a new thread on Flet GitHub discussions.

Happy Flet-ing! 👾

Flet v0.23.0 Release Announcement

· 3 min read
Henri Ndonko
Flet Contributor and Maintainer

We are excited to announce the release of Flet 0.23.0. It is a big release with many new features and bug fixes.

New Controls

New Properties

Error Handling

PEP 20 (Zen of Python): Errors should never pass silently.

Several devs reported that, on some occasions, a control might visually break without clear information on what caused the break.

For example, in issue #3149, @base-13 mentioned that "in a DataTable if the number of columns is less than the number of datacells in any row it will grey out whole table without throwing error".

Knowing this, we added more assertion-checks in most of the controls, such that, when you provide them with a wrong value, an AssertionError is raised with a very clear message of what was wrongly done.

If you find out that some checks are still missing, please point them out so they can be addressed.

Command Line (CLI) Output

The output of the flet build command has been prettified.

Also, a new option has been added --show-platform-matrix which displays a table containing the build platform matrix, which has header columns "Command" (possible build commands) and "Platform" (the device you should use with the respective command).

Furthermore, when the targeted platform can't be built on your device, a table displaying the build platform matrix is shown with an informative message.

Breaking Changes

While doing "Error Handling" mentioned above, we had to mark some important properties as required.

The following properties are now "required" (must be provided and visible) when creating an instance of their classes:

Bug Fixes

The below issues were successfully fixed:

  • #3144: ScrollbarTheme.thickness value not respected when not interacting with
  • #3072: High-resolution videos play laggy on Android TV devices.
  • #3023: (Regression) Some LineChart colors not visually respected
  • #2989: Color of Dropdown when disabled doesn't reflect its disabled state
  • #1753: Markdown code block not selectable
  • #3097: Hot-reload occurs when a file is opened
  • #1647: Container.theme_mode not honoured when Container.theme=None
  • #3064: Container.on_tap_down not called when Container.on_click=None

Special Thanks to the dynamic Flet community for reporting all the issues they encountered. We keep working hard on solving the remaining ones.

Deprecations

  • All the Page.window_*** properties are now deprecated and moved to Page.window property, which is of type Window. To migrate, simply use change window_ to window. as seen below:

    # before 
    page.window_height = 200
    page.on_window_event = lambda e: print(e.type)

    # now
    page.window.height = 200
    page.window.on_event = lambda e: print(e.type)
  • SafeArea.minimum is deprecated and has been renamed to minimum_padding

  • MaterialState enum is deprecated and has been renamed to ControlState

  • NavigationDestination is deprecated and has been renamed to NavigationBarDestination

Also, the deprecation policy has been modified. While Flet is pre-1.0, all deprecations will be removed from the API after the next 3 releases. So the above deprecations made in v0.23.0 (and all the other deprecations made in the previous versions), will be removed in v0.26.0.

That's it! :)

Upgrade to Flet 0.23.0, test your apps and let us know how you find the new features we added. If you have any questions, please join Flet Discord server or create a new thread on Flet GitHub discussions.

Happy Flet-ing!

Flet packaging update

· 7 min read
Feodor Fitsner
Flet founder and developer

The problem

When you package your Flet program in Python to run on a mobile device (or desktop) the resulting bundle (.apk, .ipa, .exe, .app) contains your Python program, Python interpreter and Python Standard Library.

If your program uses only Python standard library then packaging process is relatively easy - Flet zips your code and combines Flutter app together with Python interpreter and standard library both compiled for the target platform: Android or iOS.

However, problems may arise when your Flet program uses third-party packages, with thousands of them published on PyPI or Conda.

There are two kinds of third-party packages:

Pure-Python packages

A "pure-Python" package is a package that only contains Python code, and doesn't include extensions written in C, C++, Rust or other languages. You only need a Python interpreter and the Python Standard Library to run a pure-Python package, and it doesn't matter what your OS or platform is.

Examples of such packages: httpx, click, rich, requests.

To verify if the package is pure, find that package on PyPI and navigate to its "Download files" page. If under "Built distribution" section there is only one wheel ending with -py3-none-any.whl then most probably it's a pure Python package that will work "as is" on any device with Python.

We say "probably" because that pure package could depend on a non-pure package which brings you to the next section. For example, pydantic is a pure package, but to work properly it requires pydantic-core non-pure package written in Rust.

Non-pure Python packages

A "non-pure Python" package is one that is fully or partially written in C, C++, Rust, or another language and must be compiled to machine code for the platform on which it will run.

Examples of such packages: cryptography, opencv-python, numpy, msgpack.

On "Download files" page of non-pure package you will find a bunch of wheels pre-built for various platforms: macOS, Windows, Linux.

When you run pip install <package> pip tries to find a wheel for your specific platform and Python version looking at wheel suffixes that include that information.

It's a courtesy of package developer to provide pre-compiled wheels for multiple platforms. There could be missing wheels for some platforms, or no wheels at all - just .tar.gz under "Source distribution" with package sources.

Building package from sources is hard

To install a package with source distribution only, pip will attempt to build non-Python code on your machine using installed compilers, linkers, libraries, and SDKs. However, this process can be lengthy and error-prone. The compiled code base might be large, and your machine could lack the required libraries or toolchains.

No wheels for iOS and Android yet

There are no pre-built wheels for iOS and Android on PyPI and PyPI's validation process won't allow package developers to upload them anyway as both iOS and Android are not officially supported platforms in Python.

There is a process (PEP 730 and PEP 738) to add official support for iOS and Android to Python 3.13, so, hopefully, the developer experience will improve.

Package dependencies

Pure-Python packages can import or depend on non-pure packages and you should keep that in mind while packaging your Flet app to run on a mobile device.

For example, supabase package, to access Supabase API, is a pure package which depends on pydantic package which is also pure Python package. In its turn pydantic package depends on pydantic-core which is a non-pure package written in Rust. Thus, to run your Flet app using Supabase API the packaging process should be able to find a pre-build wheel for your target platform. If PyPI doesn't have that wheel then it could be either Flet developers, building that wheel on their servers and hosting it somewhere, or you, building that wheel on your own machine.

To see a dependency graph for a package you can use pipgrip.

Run it with --tree option to get a tree view of dependencies:

$ pipgrip --tree fastapi

fastapi (0.110.3)
├── pydantic!=1.8,!=1.8.1,!=2.0.0,!=2.0.1,!=2.1.0,<3.0.0,>=1.7.4 (2.7.1)
│ ├── annotated-types>=0.4.0 (0.6.0)
│ ├── pydantic-core==2.18.2 (2.18.2)
│ │ └── typing-extensions!=4.7.0,>=4.6.0 (4.11.0)
│ └── typing-extensions>=4.6.1 (4.11.0)
├── starlette<0.38.0,>=0.37.2 (0.37.2)
│ └── anyio<5,>=3.4.0 (4.3.0)
│ ├── idna>=2.8 (3.7)
│ └── sniffio>=1.1 (1.3.1)
└── typing-extensions>=4.8.0 (4.11.0)

Current approach

We released the first version of packaging 4 months ago and since then, we have realized that the initial approach has multiple flaws and should be improved.

When you run flet build apk with the current Flet version it downloads Python runtime with standard library both pre-built for Android (or iOS if ran with flet build ipa).

For non-pure packages, like numpy, Flet is asking you to build those packages by yourself using "Python for Android" (p4a) tool from Kivy and then provide a path to "p4a" distributive where those pre-build packages could be found.

This is problem #1 - you are forced to struggle with a complicated process of installing "p4a" tool and compiling Python modules on your machine.

Problem #2 - all packages from p4a's dist directory will be included into a final application bundle - it could contain non-relevant packages and other junk.

Problem #3 - non-pure packages must be built before running flet build command. You have to analyze all dependencies of your app and separate what must be built with p4a.

Problem #4 - p4a "recipes" to build packages could be either very old or missing. You hope that older version of the package works with your app, try authoring a "recipe" and hope it works or submit a request for new recipe in Kivy repository.

When you're done with building non-pure packages using p4a, Flet requires you to specify only pure packages in requirements.txt which doesn't work if pure package directly or indirectly depends on non-pure (see example above) - this is problem #5. There is a recent example of this problem: flet build replaces flet with flet-embed in requirements.txt, but it's unable to know if there is a 3rd-party package depending on flet, thus both flet-embed and non-suitable-for-mobile flet are installed. This is not a solution, but a hack!

Packaging 2.0

In the next iteration of Flet's packaging implementation, we are going to move away from Kivy and replace it with Mobile Forge. Mobile Forge has been created by Beeware team based and their experience with Briefcase and Chaquopy. Mobile Forge is a clean-room implementation of a packaging tool for binary Python packages which is relies on crossenv.

The main promise of Mobile Forge with crossenv is that most existing non-pure Python packages will be able to compile for iOS and/or Android by simply adding a recipe with meta.yaml file only, without requiring any hacks or patches.

We are going to use Mobile Forge to pre-build the most popular non-pure Python packages for iOS and Android and host them in our own public repository. You will be able to use that tool to build and contribute other packages, non present in our repository.

We've created a new "Packages" category in Flet discussions where you can post, vote and discuss requests for non-pure (native) Python packages that work with Flet (check rules before posting there). Flet's goal is to provide the most comprehensive catalog of pre-built Python packages and make the process of adding new packages as friendly and transparent as possible.

The new version of flet build will use a custom-made virtual pip index. This index will analyze dependencies, detect non-pure packages, and offer to pip mobile packages. For all other packages, it will fall back to PyPI.

The new packaging will be hopefully available in a few weeks. While we are working we encourage you to visit Packages and see if the package you need is there. Submitting a request or voting for existing package will help us to prioritize package "recipes".

Thank you!

Controls and theming enhancements

· 5 min read
Henri Ndonko
Flet Contributor and Maintainer

One month after the release of Flet 0.21.0, we are excited to announce the release of Flet 0.22.0.

This release comes with a lot of enhancements, bug fixes, and deprecations:

Enhancements

This was one of the main concerns while coming up with this release. Two types of enhancements were made:

Controls Enhancement

We went through the long list of already-present controls and exposed, where possible, more properties - PR #2882. This will grant you more power/control over the Flet Controls you use in your awesome applications.

Below is the complete list:

  • AppBar: elevation_on_scroll, exclude_header_semantics, force_material_transparency, is_secondary, shadow_color, surface_tint_color, clip_behavior, title_spacing, toolbar_opacity, title_text_style, toolbar_text_style, shape
  • AlertDialog: action_button_padding, clip_behavior, icon_padding, shadow_color, surface_tint_color
  • Banner: content_text_style, margin, elevation, divider_color, shadow_color, surface_tint_color, on_visible
  • CupertinoListTile: leading_size, leading_to_title
  • CupertinoSegmentedButton: click_color
  • CupertinoSwitch:on_label_color, off_label_color
  • CupertinoTimerPicker: item_extent
  • Chip: surface_tint_color, color, click_elevation, clip_behavior, visual_density, border_side
  • Divider: leading_indent, trailing_indent
  • ExpansionTile: dense, enable_feedback, visual_density
  • Card: clip_behavior, is_semantic_container, show_border_on_foreground, variant
  • Checkbox: border_side, semantics_label, shape, splash_radius, is_error, visual_density, mouse_cursor
  • CircleAvatar: on_image_error
  • DataTable: clip_behavior
  • DatePicker: on_entry_mode_change
  • Draggable: on_drag_complete, on_drag_start
  • DragTarget: on_move
  • Dropdown: fill_color, hint_content, icon_content, elevation, item_height, max_menu_height, icon_size, enable_feedback, padding, icon_enabled_color, icon_disabled_color, on_click
  • ElevatedButton: clip_behavior
  • FloatingActionButton: clip_behavior, enable_feedback, focus_color, foreground_color, disabled_elevation, elevation, focus_elevation, highlight_elevation, hover_elevation, mouse_cursor
  • GridView: cache_extent, clip_behavior, semantic_child_count
  • IconButton: alignment, disabled_color, focus_color, enable_feedback, hover_color, padding, splash_color, splash_radius, focus_color, mouse_cursor, visual_density
  • Image: exclude_from_semantics, filter_quality
  • ListTile: enable_feedback, horizontal_spacing, min_leading_width, min_vertical_padding, selected_color, selected_tile_color, style, title_alignment, icon_color, text_color, shape, visual_density, mouse_cursor, title_text_style, subtitle_text_style, leading_and_trailing_text_style
  • ListView: cache_extent, clip_behavior, semantic_child_count
  • NavigationBar: animation_duration, overlay_color
  • NavigationDrawerDestination: bgcolor
  • NavigationBarDestination: bgcolor
  • NavigationRail: selected_label_text_style, unselected_label_text_style
  • NavigationRailDestination: indicator_color, indicator_shape
  • Option: alignment, on_click
  • OutlinedButton: clip_behavior
  • Page: locale_configuration
  • PopupMenuItem: height, padding, mouse_cursor
  • PopupMenuButton: bgcolor, clip_behavior, elevation, enable_feedback, icon_color, shadow_color, surface_tint_color, icon_size, padding, splash_radius, shape, on_open, on_cancel
  • ProgressBar: border_radius, semantics_label, semantics_value
  • ProgressRing: semantics_label, semantics_value, stroke_cap, stroke_align
  • Radio: focus_color, hover_color, overlay_color, splash_radius, toggleable, visual_density, mouse_cursor
  • SearchBar: keyboard_type, view_surface_tint_color, autofocus
  • SelectionArea: on_change
  • Slider: interaction, overlay_color, mouse_cursor, secondary_track_value, secondary_active_color
  • Stack: alignment, fit
  • SnackBar: clip_behavior, shape, on_visible, action_overflow_threshold
  • Switch: hover_color, splash_radius, overlay_color, track_outline_color, mouse_cursor
  • Tabs: divider_height, enable_feedback, indicator_thickness, is_secondary, mouse_cursor, clip_behavior
  • TextField: fill_color, hover_color
  • TimePicker: orientation, on_entry_mode_change
  • Tooltip: enable_tap_to_dismiss, exclude_from_semantics
  • VerticalDivider: leading_indent, trailing_indent

If you however feel that something lacks and should be added, don't hesitate to let us know.

Check out the article I wrote concerning Page.locale_configuration here.

Theme Enhancements

The Theme class which is used for application theming in light and dark mode has equally been further enhanced. Lots of new themes were introduced - PR #2955.

See the Theming Guide here.

Rive Animations

Rive is a very popular real-time interactive design and animation tool. The newly introduced Rive Control allows you to load and visualize any Rive animation in your applications.

The animation's source (Rive.src) can either be a local asset file or a URL - as usual, it all depends on your needs.

Parent Control

As requested in #952, the ability to access the parent of any control has been added: Control.parent.

Read more on it here.

Bug Fixes

The below issues were successfully fixed:

  • #2560 - Dropdown.bgcolor was not visually respected
  • #2740 - CircleAvatar not working with local asset images
  • #2781 - 'FletSocketServer' Error raised on Linux
  • #2826 - PopupMenuItem.data not respected
  • #2839 - ExpansionTile.initially_expanded had no visual effect
  • #2867 - PopupMenuButton had an always-visible tooltip of "Show menu"
  • On some Python versions, you might have seen a RuntimeError('Event loop is closed') which usually shows up when closing the app's window. The Python-dev team fixed this asyncio-related issue recently, but this fix is only present in the versions released from the year 2024. So if you face this issue, please download one of the latest Python releases and replace the one used in your environment.

Special Thanks to the dynamic Flet community for reporting all the issues they encountered. We keep working hard on solving the remaining ones.

Deprecations

As previously mentioned in the announcement concerning Flet v0.21.0, all deprecations will be completely removed from the API in version 1.0 - so you have enough time to update your apps.

You must not completely memorize what has been deprecated as we've added DeprecationWarnings which will be shown directly in your console (without breaking your app).

Documentation

The Flet documentation has been reorganized to ease navigation (especially for beginners/new users).

Upgrade to Flet 0.22.0, test your apps and let us know how you find the new features we added. If you have any questions, please join Flet Discord server or create a new thread on Flet GitHub discussions.

Happy Flet-ing!