Integration package for Dishka DI and Flet framework
Project description
Flet integration for Dishka
Though it is not required, you can use dishka-flet integration. It features:
- REQUEST scope management using sessions
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. You can use
faststream.types.StreamMessageandfaststream.ContextRepoas a factory parameter to access on REQUEST-scope
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)
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
dishka_flet-0.0.1.tar.gz
(157.2 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file dishka_flet-0.0.1.tar.gz.
File metadata
- Download URL: dishka_flet-0.0.1.tar.gz
- Upload date:
- Size: 157.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.9.18 {"installer":{"name":"uv","version":"0.9.18","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}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8f1d7cfc78cc7f3dddd8749622c6e07313461f794708a16edb148b897081d73e
|
|
| MD5 |
6bb85e1c889fadb3f91e3cc9847ca7c6
|
|
| BLAKE2b-256 |
d25ab273055636c8e391b1b10dbb8a4ad5c9b765de4545a1ad84cad1b43c0c99
|
File details
Details for the file dishka_flet-0.0.1-py3-none-any.whl.
File metadata
- Download URL: dishka_flet-0.0.1-py3-none-any.whl
- Upload date:
- Size: 7.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.9.18 {"installer":{"name":"uv","version":"0.9.18","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}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6af161fef97fe7c60aeceb4473fae92c4dd33f67c8108219f53a612f15cc114b
|
|
| MD5 |
004d4037476f3dfaa51a6b688dcc827c
|
|
| BLAKE2b-256 |
3d1d4643ad31e065d183b866ce129fb306431f8ea5c56d5e5e64aa93bdda1e0a
|