Flet integration for Dishka
Though it is not required, you can use dishka-flet integration. It features:
- REQUEST scope management using sessions
- APP scope management using sessions
- FletProvider for working with
Pagein container
You need to specify @inject manually.
Installation
Install using pip
pip install dishka-flet
Or with uv
uv add dishka-flet
How to use
- Import
from dishka_flet import (
FromDishka,
inject,
setup_dishka
)
from dishka import make_async_container, Provider, provide, Scope
- Create provider like here below
class MyProvider(Provider):
@provide(scope=Scope.REQUEST)
def get_greeting_service(self) -> GreetingService:
return GreetingService(name="Dishka User")
@provide(scope=Scope.APP)
def get_counter_service(self) -> CounterService:
return CounterService()
- Mark those of your handlers parameters which are to be injected with
FromDishka[]
@inject
async def button_clicked(
event: ft.ControlEvent,
greeting: FromDishka[GreetingService],
counter: FromDishka[CounterService],
) -> None:
...
- Setup
dishkaintegration.
setup_dishka(container=container, page=page)
Metadata
Release files for dishka-flet 0.0.4
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| dishka_flet-0.0.4.tar.gz | 165.4 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| dishka_flet-0.0.4-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 175.0 kB
Release files / dishka_flet-0.0.4.tar.gz
| Download URL | dishka_flet-0.0.4.tar.gz |
|---|---|
| Size | 165.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
7c5f0c86783bc7040dbd00907d9313c207400c5d70d20b7cf65b89495556a5a2
|
|
BLAKE2b-256 checksum How to use checksums |
94da3b3e7ceefa73aac87efd11792bda704f1259f9a38ad1cdf9b69fa62f16ef
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.9.29 {"installer":{"name":"uv","version":"0.9.29","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Release files / dishka_flet-0.0.4-py3-none-any.whl
| Download URL | dishka_flet-0.0.4-py3-none-any.whl |
|---|---|
| Size | 9.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
c4c1f0edda8232832b658fda3b0476fad7b75d2ea6693576bb98ff3e4ff0c1aa
|
|
BLAKE2b-256 checksum How to use checksums |
6f274a9d058e6aa7a6ad5b3b62f564fdf00fd5565318d3d4f31393b2f866d295
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.9.29 {"installer":{"name":"uv","version":"0.9.29","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|