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
  • FletProvider for working with Page in 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

  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.4.tar.gz (165.4 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.4-py3-none-any.whl (9.6 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: dishka_flet-0.0.4.tar.gz
  • Upload date:
  • Size: 165.4 kB
  • Tags: Source
  • Uploaded using 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}

File hashes

Hashes for dishka_flet-0.0.4.tar.gz
Algorithm Hash digest
SHA256 7c5f0c86783bc7040dbd00907d9313c207400c5d70d20b7cf65b89495556a5a2
MD5 4099e9ac9985422ce53e4b946b4aa47b
BLAKE2b-256 94da3b3e7ceefa73aac87efd11792bda704f1259f9a38ad1cdf9b69fa62f16ef

See more details on using hashes here.

File details

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

File metadata

  • Download URL: dishka_flet-0.0.4-py3-none-any.whl
  • Upload date:
  • Size: 9.6 kB
  • Tags: Python 3
  • Uploaded using 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}

File hashes

Hashes for dishka_flet-0.0.4-py3-none-any.whl
Algorithm Hash digest
SHA256 c4c1f0edda8232832b658fda3b0476fad7b75d2ea6693576bb98ff3e4ff0c1aa
MD5 58f03306f08f169be0e53cd6f674a05e
BLAKE2b-256 6f274a9d058e6aa7a6ad5b3b62f564fdf00fd5565318d3d4f31393b2f866d295

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