Skip to main content

Integration package for Dishka DI and Jobify framework

Project description

Jobify integration for Dishka

Downloads Package version Supported Python versions

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

  • REQUEST scope management using jobify request scope
  • JobifyProvider for working with JobContext, Job, State, RequestState, Runnable in container

You need to specify @inject manually.

Installation

Install using pip

pip install dishka-jobify

Or with uv

uv add dishka-jobify

How to use

  1. Import
from dishka_jobify 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[]
@app.task
@inject
async def my_cron(
    greeting: FromDishka[GreetingService],
    counter: FromDishka[CounterService],
) -> None:
    count = counter.increment()
    print(f"[cron] {greeting.greet('cron')} count={count}")
  1. Setup dishka integration.
UTC = ZoneInfo("UTC")
app = Jobify(tz=UTC)

provider = MyProvider()
container = make_async_container(provider, JobifyProvider())
setup_dishka(container=container, app=app)

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_jobify-0.0.1.tar.gz (122.5 kB view details)

Uploaded Source

Built Distribution

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

dishka_jobify-0.0.1-py3-none-any.whl (10.1 kB view details)

Uploaded Python 3

File details

Details for the file dishka_jobify-0.0.1.tar.gz.

File metadata

  • Download URL: dishka_jobify-0.0.1.tar.gz
  • Upload date:
  • Size: 122.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.9.26 {"installer":{"name":"uv","version":"0.9.26","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_jobify-0.0.1.tar.gz
Algorithm Hash digest
SHA256 0cebcc19f5fe0dff602875dcd1a80444eabf43bb59d48334f49f822db9fac9ec
MD5 2cce45ccd4cecf9c5fb021d27cd9a305
BLAKE2b-256 20d08a6d7d18ccd7cb7ce7b9f58622103aee6778aa31cef939f942395815799c

See more details on using hashes here.

File details

Details for the file dishka_jobify-0.0.1-py3-none-any.whl.

File metadata

  • Download URL: dishka_jobify-0.0.1-py3-none-any.whl
  • Upload date:
  • Size: 10.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.9.26 {"installer":{"name":"uv","version":"0.9.26","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_jobify-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 01ff29c7061128be24d331b1a15dc798cc1262a5caa52a5d5311c12b4dfcce4c
MD5 027788b64b7df8b1d9c8d1a3e9f868b6
BLAKE2b-256 c3c0ac6cb4de9e5a1296a4254f76d87f50e134a4e0177a67c31eed6f0e85e89f

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