ashka
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3c78902f1157a6be82122a040c8d77c4ef3b8fd9dcb97d992271e393e34809fe
|
|
| MD5 |
4aa2cbe81d310f396be46685fe7d9ab0
|
|
| BLAKE2b-256 |
07c86f68e06fc2807db79652f6be631b6696dab97018cd12fa721e3c4c4fe509
|
Provenance
The following attestation bundles were made for ashka-0.9.7.tar.gz:
Publisher:
publish.yml on handsome-Druid/ashka
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
ashka-0.9.7.tar.gz -
Subject digest:
3c78902f1157a6be82122a040c8d77c4ef3b8fd9dcb97d992271e393e34809fe - Sigstore transparency entry: 2635720849
- Sigstore integration time:
-
Permalink:
handsome-Druid/ashka@eff2592298c82de08d2fe03587a9f987263cbaad -
Branch / Tag:
refs/tags/v0.9.7 - Owner: https://github.com/handsome-Druid
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@eff2592298c82de08d2fe03587a9f987263cbaad -
Trigger Event:
push
-
Statement type:
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b662bdde3130c35d20e3aab298581669e32cccc2b37c4890b00c7e54a41c3e6e
|
|
| MD5 |
310dedadb07b22ca60ce95410f4c8229
|
|
| BLAKE2b-256 |
b48ad39b00136b1b1b8cab0a75441b49611a18f8ff0a270d780a13508821f0d7
|
Provenance
The following attestation bundles were made for ashka-0.9.7-py3-none-any.whl:
Publisher:
publish.yml on handsome-Druid/ashka
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
ashka-0.9.7-py3-none-any.whl -
Subject digest:
b662bdde3130c35d20e3aab298581669e32cccc2b37c4890b00c7e54a41c3e6e - Sigstore transparency entry: 2635720858
- Sigstore integration time:
-
Permalink:
handsome-Druid/ashka@eff2592298c82de08d2fe03587a9f987263cbaad -
Branch / Tag:
refs/tags/v0.9.7 - Owner: https://github.com/handsome-Druid
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@eff2592298c82de08d2fe03587a9f987263cbaad -
Trigger Event:
push
-
Statement type: