flet README

README проекта с github.com/flet-dev/flet. Одним файлом markdown: README.md.

Flet logo

Build cross-platform apps in Python. No frontend experience required.

License Package version Monthly downloads Python >= 3.10 Build status Docstring coverage

Flet is a Python framework for building web, desktop, and mobile apps without prior experience in frontend development.

Try Flet online in Flet Studio

Create, run, and share Python apps in your browser. Start from an example, write your own code, or get help from the AI agent. No installation required.

   One Python codebase, six platforms

Build your interface and application logic in Python, and run your app on iOS, Android, Windows, macOS, Linux, and web. No Dart, Swift, Kotlin, HTML, or JavaScript required.

   150+ built-in controls and services

Create your interface with ready-made layouts, buttons, forms, navigation, and dialogs. Customize colors, typography, and themes, with Material and Cupertino controls to suit your app.

   Declarative UI for growing apps

Organize your app into reusable components and let the UI update when application state changes. Prefer changing controls directly? The imperative style is supported too. Compare the approaches.

   Your Python libraries, on mobile

Use libraries such as NumPy, pandas, Pillow, and cryptography in your mobile apps. Flet provides prebuilt binary packages for iOS and Android, so you don't have to compile native dependencies yourself.

   Run in the browser or on your server

Run Python directly in the browser with Pyodide and WebAssembly, with no Python server required. Or keep your Python code on a server and deliver real-time UI updates to the browser.

   Built-in packaging

Use flet build to package your app for desktop, mobile, or web distribution, including the App Store and Google Play. Configure dependencies, icons, and platform settings in your project's pyproject.toml.

   Test your app on desktop and mobile

Write integration tests with pytest and run them against your packaged app with flet test. Tap buttons, enter text, and verify user flows on desktop and mobile, with screenshot comparisons on Android and iOS.

   Build with help from AI

Explore and create apps with the AI agent in Flet Studio, or connect your coding assistant to the Flet MCP server for version-specific API information and tools to find examples and icons.

   Extensible

Build custom controls in Python by composing existing controls, or create extensions that wrap Flutter packages to add new UI components and platform integrations.

   Accessible

Add screen-reader labels, tooltips, keyboard shortcuts, and custom semantics to help more people use your app. Inspect the accessibility information your UI exposes with the semantics debugger.

Flet app example

This simple counter app displays a number in the center of the screen. Press the + button to increment it:

import flet as ft


def main(page: ft.Page):
    counter = ft.Text("0", size=50, data=0)

    def increment_click(e):
        counter.data += 1
        counter.value = str(counter.data)

    page.floating_action_button = ft.FloatingActionButton(
        icon=ft.Icons.ADD, on_click=increment_click
    )
    page.add(
        ft.SafeArea(
            expand=True,
            content=ft.Container(
                content=counter,
                alignment=ft.Alignment.CENTER,
            ),
        )
    )


ft.run(main)

To run the app, install flet:

pip install 'flet[all]'

Save the code as counter.py, then launch the app:

flet run counter.py

This opens the app in a native desktop window. The screenshot below shows it after pressing + three times:

To run the same app in your browser, add --web:

flet run --web counter.py

Learn more

Community

Contributing

Want to help improve Flet? Check out the contribution guide.

flet (flet-dev/flet)

Ищем в базе…

17.6K ·GitHub
Что это такое?Flet — это Python-фреймворк для создания веб-, мобильных и настольных приложений из единой кодовой базы на Python — опыт фронтенд-разработки не нужен, интерфейс отрисовывает Flutter.
То есть это фреймворк, а не конструктор приложений — что именно я пишу?Вы пишете всё приложение на Python, используя контролы Flet; фреймворк сам берёт на себя отрисовку интерфейса через Flutter, сборку под разные платформы и упаковку.
Как запустить первое приложение?Установите flet, затем запустите его командой 'flet run' — приложение откроется в нативном окне операционной системы; добавьте флаг '--web', чтобы запустить то же приложение в браузере.
Помимо Python нужен ещё Dart, Swift или JavaScript?Нет — только Python. Flet даже включает более 50 популярных Python-пакетов для iOS и Android, среди них numpy, pandas, pydantic, cryptography, opencv и pillow.
Один и тот же код действительно работает и на телефоне, и на компьютере, и в браузере?Да — одна кодовая база покрывает iOS, Android, Windows, Linux, macOS и веб. В браузере приложение работает нативно через WebAssembly и Pyodide без сервера, либо его можно развернуть на сервере с обновлением интерфейса в реальном времени.
Какие готовые элементы интерфейса в нём есть?Более 150 встроенных контролов и сервисов в стилистике Material и Cupertino: разметка, навигация, диалоги и графики.
Как протестировать приложение на телефоне во время разработки?Откройте проект на своём устройстве iOS или Android через приложение Flet App и смотрите, как изменения появляются на ходу.
Как распространять готовое приложение?Встроенная упаковка создаёт самостоятельные исполняемые файлы или пакеты для iOS, Android, Windows, Linux, macOS и веба, готовые к публикации в App Store и Google Play.
Можно ли добавить контролы, которых нет в Flet?Да — можно обернуть любой из тысяч существующих Flutter-пакетов для использования с Flet или собрать новые контролы на чистом Python из встроенных UI-примитивов.
Какие есть похожие проекты?flutter, Avalonia, whisker, native, compose-multiplatform, kivy, samples, egui
Автор
flet-dev
Размер
236.1 MB
Звёзды
17.6K
Возраст
4 г
Коммиты · 90 дней