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

Uploaded Python 3

File details

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

File metadata

  • Download URL: ashka-0.9.7.tar.gz
  • Upload date:
  • Size: 6.9 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.7.tar.gz
Algorithm Hash digest
SHA256 3c78902f1157a6be82122a040c8d77c4ef3b8fd9dcb97d992271e393e34809fe
MD5 4aa2cbe81d310f396be46685fe7d9ab0
BLAKE2b-256 07c86f68e06fc2807db79652f6be631b6696dab97018cd12fa721e3c4c4fe509

See more details on using hashes here.

Provenance

The following attestation bundles were made for ashka-0.9.7.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.7-py3-none-any.whl.

File metadata

  • Download URL: ashka-0.9.7-py3-none-any.whl
  • Upload date:
  • Size: 15.9 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.7-py3-none-any.whl
Algorithm Hash digest
SHA256 b662bdde3130c35d20e3aab298581669e32cccc2b37c4890b00c7e54a41c3e6e
MD5 310dedadb07b22ca60ce95410f4c8229
BLAKE2b-256 b48ad39b00136b1b1b8cab0a75441b49611a18f8ff0a270d780a13508821f0d7

See more details on using hashes here.

Provenance

The following attestation bundles were made for ashka-0.9.7-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

This release

0.9.7 This release

2 files

0.9.6

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