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.3.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.3-py3-none-any.whl (9.6 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: dishka_flet-0.0.3.tar.gz
  • Upload date:
  • Size: 165.4 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.3.tar.gz
Algorithm Hash digest
SHA256 d2c5261b136f1a3c28f58760009cacb6996c242c03440a4d37245223efb424c7
MD5 d224449b6a474770b13f6beb4c3a42bb
BLAKE2b-256 6e47bacfab943bf994d80858f38332ce73c087bec482a46d09f3070aa9f5a3db

See more details on using hashes here.

File details

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

File metadata

  • Download URL: dishka_flet-0.0.3-py3-none-any.whl
  • Upload date:
  • Size: 9.6 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.3-py3-none-any.whl
Algorithm Hash digest
SHA256 31238fc8d55bd720df0b848249e995e2dca8bd2ff20c027c896cc5dcad7c0c30
MD5 c40fef1b5b46ba82abef73a61e8d702c
BLAKE2b-256 e8ec48869b04d9ee9920c6bd97fc91a874ca184640573ac5617462b09a9b6ee9

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