Skip to main content

Async dependency injection for Python functions

Project description

uncalled-for

Async dependency injection for Python functions.

Declare what your function needs as parameter defaults. They show up resolved when the function runs. No ceremony, no container, no configuration.

from uncalled_for import Depends

async def get_db():
    db = await connect()
    try:
        yield db
    finally:
        await db.close()

async def handle_request(db: Connection = Depends(get_db)):
    await db.execute("SELECT 1")

Features

  • Zero dependencies — standard library only
  • Async-native — built on AsyncExitStack and ContextVar
  • Context manager lifecycle — sync and async generators get proper cleanup
  • Nested dependencies — dependencies can depend on other dependencies
  • Caching — each dependency resolves once per call, even if referenced multiple times

Install

pip install uncalled-for

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

uncalled_for-0.2.0.tar.gz (49.5 kB view details)

Uploaded Source

Built Distribution

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

uncalled_for-0.2.0-py3-none-any.whl (11.4 kB view details)

Uploaded Python 3

File details

Details for the file uncalled_for-0.2.0.tar.gz.

File metadata

  • Download URL: uncalled_for-0.2.0.tar.gz
  • Upload date:
  • Size: 49.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for uncalled_for-0.2.0.tar.gz
Algorithm Hash digest
SHA256 b4f8fdbcec328c5a113807d653e041c5094473dd4afa7c34599ace69ccb7e69f
MD5 bf2811484c8044cc488e7aa4de6c3764
BLAKE2b-256 027cb5b7d8136f872e3f13b0584e576886de0489d7213a12de6bebf29ff6ebfc

See more details on using hashes here.

Provenance

The following attestation bundles were made for uncalled_for-0.2.0.tar.gz:

Publisher: publish.yml on chrisguidry/uncalled-for

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

File details

Details for the file uncalled_for-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: uncalled_for-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 11.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for uncalled_for-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 2c0bd338faff5f930918f79e7eb9ff48290df2cb05fcc0b40a7f334e55d4d85f
MD5 22275bce27af3f7714eb4064fe9bc4a3
BLAKE2b-256 ff7f4320d9ce3be404e6310b915c3629fe27bf1e2f438a1a7a3cb0396e32e9a9

See more details on using hashes here.

Provenance

The following attestation bundles were made for uncalled_for-0.2.0-py3-none-any.whl:

Publisher: publish.yml on chrisguidry/uncalled-for

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

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