Skip to main content

LEFT, a Minimalist Flet Framework

A very simple framework using the flet library - the bare boilerplate code I use to get some apps up and running.

I have deliberately kept things extremely simple - it doesn't attempt to hide the flet internals, very little enforced convention/configuration, and only a tiny reliance on some 'magic' in the React-influenced state management in the view layer (even this is not mandatory).

Its up to the end user to organise their implementation in a consistent and logical manner that works for them.

dev usage (requires python >= 3.10)

pip install python-left

See Developer Guide and sampleapp/ for a more fully-fledged CRUD-app example.

Here is the simplest possible app usage:

import flet as ft
from left import LeftApp, LeftController, LeftView
from left.sharedcomponents import loading_spinner
from left.helpers import redirect


class MyView(LeftView):
    def __init__(self):
        self.state = {"message": None}

    def update_state(self, **new_state):
        self.state.update(new_state)

    @property
    def appbar(self):
        return ft.AppBar(
            actions=[
                ft.ElevatedButton("Home", on_click=lambda _: redirect("/")),
                ft.ElevatedButton("Page2", on_click=lambda _: redirect("/page/view/page2"))
            ]
        )

    @property
    def controls(self):
        if self.state["message"] is None:
            return [loading_spinner()]
        return [
            ft.Text(self.state["message"])
        ]


class MyController(LeftController):
    def index(self):
        view = MyView()
        self._mount_view(view)
        view.update_state(message="welcome to the app!")

    def load_page(self, uid):
        view = MyView()
        self._mount_view(view)
        view.update_state(message=f"Display contents for {uid} here...")


def on_route_change(page, parts):
    match parts:
        case ['']:
            MyController(page).index()
        case ['page', 'view', uid]:
            MyController(page).load_page(uid)
        case _:
            print(f"Unrecognised route: {page.route}")


LeftApp(
    router_func=on_route_change,
    default_title="A Very Simple App")

Metadata

Release files for python-left 0.0.9

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for python-left 0.0.9
File Size Uploaded Provenance Actions
python_left-0.0.9.tar.gz 17.2 kB With provenance Details for python_left-0.0.9.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for python-left 0.0.9
File Interpreter ABI Platform Actions
python_left-0.0.9-py3-none-any.whl Python 3 none any Details for python_left-0.0.9-py3-none-any.whl

Total release size: 38.1 kB

Release files / python_left-0.0.9.tar.gz

Download URL python_left-0.0.9.tar.gz
Size 17.2 kB
Tags Source
SHA-256 checksum
How to use checksums
e2883bd0c2fc93ac537529f8d279dea6d8b46ac877188131d9e5bfbc41f5c82a
BLAKE2b-256 checksum
How to use checksums
28f9cffc619258ce32517c64124f26ae0e4dfb8aa301c8df06054f0d3458bce3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.12.9

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on May 1, 2025.

Transparency log

Release files / python_left-0.0.9-py3-none-any.whl

Download URL python_left-0.0.9-py3-none-any.whl
Size 20.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
052d46b46afb2bcda7faffe0f6d9c28a50aedd251ff62c4d9d65210c7cc28dce
BLAKE2b-256 checksum
How to use checksums
6246324363893908776112b38f3dd57c2c44a4eb4cb8b44c0c84e227463c5ff7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.12.9

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on May 1, 2025.

Transparency log

Security for python-left 0.0.9

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for python_left-0.0.9.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on May 1, 2025.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page