Skip to main content

ashka

CI Publish Update dishka

ashka extends reagento/dishka with async/sync application lifecycle support.

The a prefix lets ashka sort before dishka, helping ensure the correct import order.

Application Lifecycle

This feature requires the ashka[lifecycle] extra.

Declare the resources that must be ready before the application starts doing work. Ashka initializes them with the application. During runtime, they follow dishka's APP-scope behavior. When the container closes, dishka closes generator-based resources:

from collections.abc import AsyncIterator

import ashka
from ashka import AshkaScope, async_lifespan, provide
from dishka import Provider, make_async_container
from fastapi import FastAPI


class Database:
    async def connect(self) -> None: ...

    async def close(self) -> None: ...


class ApplicationProvider(Provider):
    @provide(scope=AshkaScope.BOOTSTRAP)
    async def database(self) -> AsyncIterator[Database]:
        database = Database()
        await database.connect()
        yield database
        await database.close()


app = FastAPI(lifespan=async_lifespan)
container = make_async_container(ApplicationProvider())

ashka.integrations.setup_dishka(container, app)
  • Startup: Bootstrap dependencies are initialized before the application starts doing work.
  • Runtime: Dependencies retain dishka's APP-scope caching and dependency behavior.
  • Shutdown: Dishka closes generator-based resources with the container.

Independent asynchronous Bootstrap dependencies initialize concurrently. When initialization order matters, express it through provider parameters.

Container Access

This feature is available in the base ashka package and does not require the lifecycle extra.

Attach a container through the central integration entry point, then retrieve the same container wherever the framework object is available:

import ashka
from dishka import make_async_container
from fastapi import FastAPI


app = FastAPI()
container = make_async_container()

ashka.integrations.setup_dishka(container, app)

assert ashka.integrations.get_container(app) is container

The central entry points dispatch to the corresponding integration from the runtime type of the framework object.

Documentation

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ashka-0.9.6.tar.gz (6.7 kB view details)

Uploaded Source

Built Distribution

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

ashka-0.9.6-py3-none-any.whl (15.0 kB view details)

Uploaded Python 3

File details

Details for the file ashka-0.9.6.tar.gz.

File metadata

  • Download URL: ashka-0.9.6.tar.gz
  • Upload date:
  • Size: 6.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for ashka-0.9.6.tar.gz
Algorithm Hash digest
SHA256 6b29ce0b2f71e01ff46b929bbc9dc3fcacc3d0930b837e1413ed052570bfaf14
MD5 6da9e48e6825de587cbbdd739ac513d7
BLAKE2b-256 b87ee1689e47d7849ac9f1102d27885f2d49f7a1eac30e894f1ea275d0207ccb

See more details on using hashes here.

Provenance

The following attestation bundles were made for ashka-0.9.6.tar.gz:

Publisher: publish.yml on handsome-Druid/ashka

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file ashka-0.9.6-py3-none-any.whl.

File metadata

  • Download URL: ashka-0.9.6-py3-none-any.whl
  • Upload date:
  • Size: 15.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for ashka-0.9.6-py3-none-any.whl
Algorithm Hash digest
SHA256 77b9459e1ddf2809376ba88391ddef2189c0f80caa7d9daa2e4eaded740726c0
MD5 f17a49b76e05525e4ef37d94ca67e692
BLAKE2b-256 e518345a0d1940742969fc54747e438707b1861bd86e7ab11ce472e0c7d9640f

See more details on using hashes here.

Provenance

The following attestation bundles were made for ashka-0.9.6-py3-none-any.whl:

Publisher: publish.yml on handsome-Druid/ashka

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

0.9.7

2 files

This release

0.9.6 This release

2 files

0.9.5

2 files

0.9.4

2 files

0.9.3

2 files

0.9.2

2 files

0.9.1

2 files

0.9.0

2 files

0.8.8

2 files

0.8.7

2 files

0.8.6

2 files

0.8.5

2 files

0.8.4

2 files

0.8.3

2 files

0.8.1

2 files

0.8.0

2 files

0.6.0

2 files

0.5.2

2 files

0.5.1

2 files

0.5.0

2 files

0.4.1

2 files

0.4.0

2 files

0.3.0

2 files

0.2.4

2 files

0.2.3

2 files

0.2.2

2 files

0.2.1

2 files

0.2.0

2 files

0.1.1

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page