Skip to main content

Integration package for Dishka DI and Flet framework

Project description

Flet integration for Dishka

Downloads Package version Supported Python versions

Though it is not required, you can use dishka-flet integration. It features:

  • REQUEST scope management using sessions
  • APP 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

  1. Import
from dishka_flet import (
    FromDishka,
    inject,
    setup_dishka
)
from dishka import make_async_container, Provider, provide, Scope
  1. 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()
  1. 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:
    ...
  1. Setup dishka integration.
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.2.tar.gz (164.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

dishka_flet-0.0.2-py3-none-any.whl (8.9 kB view details)

Uploaded Python 3

File details

Details for the file dishka_flet-0.0.2.tar.gz.

File metadata

  • Download URL: dishka_flet-0.0.2.tar.gz
  • Upload date:
  • Size: 164.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.9.28 {"installer":{"name":"uv","version":"0.9.28","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

Hashes for dishka_flet-0.0.2.tar.gz
Algorithm Hash digest
SHA256 b27be2960a36a042236bfc46b28e948e2a12963744eebbf4c26e39653de35d62
MD5 fca89ac3d0d9a08f7659889f7420b71c
BLAKE2b-256 2153694f238d786c7541db1f3a0f3858f65fe98109f15431bdce12107bb636cc

See more details on using hashes here.

File details

Details for the file dishka_flet-0.0.2-py3-none-any.whl.

File metadata

  • Download URL: dishka_flet-0.0.2-py3-none-any.whl
  • Upload date:
  • Size: 8.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.9.28 {"installer":{"name":"uv","version":"0.9.28","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

Hashes for dishka_flet-0.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 4a5a296057f751349325f5dc02720eb12a5aae0af08e52832516155064021036
MD5 42f156a2fcabff809f8db37c6336e353
BLAKE2b-256 0a46389929c71154ee049ccfd50d8fe7fb07c6e0e61587c6b581a159aa3f5e8a

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page