Skip to main content

FastAPI inferring Depends

PyPI version GitHub license PyPI - Downloads Tests

A wrapper around FastAPI's Depends function that infers its return type from its input

Example

from fastapi_inferring_depends import Depends
from fastapi import FastAPI

router = FastAPI()


async def answer_to_everything_dependency():
    return 42


@app.get("/answer")
async def get_answer_to_everything(
    answer_to_everything=Depends(answer_to_everything_dependency),
):
    # type of answer_to_everything is 'int' (inferred from dependency)
    return {"answer": answer_to_everything}

For more examples, look at the test/example file for all supported inferences.

Download files

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

Source Distribution

fastapi_inferring_depends-1.0.0.post1.tar.gz (2.4 kB view details)

Uploaded Source

Built Distribution

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

File details

Details for the file fastapi_inferring_depends-1.0.0.post1.tar.gz.

File metadata

File hashes

Hashes for fastapi_inferring_depends-1.0.0.post1.tar.gz
Algorithm Hash digest
SHA256 c24e8a87971934559e692e8559cb2e76be976578c613473d4f50dcedb5e60cf7
MD5 9577b5dc5deadbdea46a0f852b634f62
BLAKE2b-256 f57d4389678da308871611729578f6f99b7d3583f4b738ba8da701bddf670c45

See more details on using hashes here.

File details

Details for the file fastapi_inferring_depends-1.0.0.post1-py3-none-any.whl.

File metadata

File hashes

Hashes for fastapi_inferring_depends-1.0.0.post1-py3-none-any.whl
Algorithm Hash digest
SHA256 2f47a86493149c1178440e0369605feef1fe6d193c004e432dc28e15449e21be
MD5 38474d832146d610f12118d27275bcfe
BLAKE2b-256 02df14d1649aef6e1a85098ebf8e080f992a35a0d3085ff00d14368681e73167

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

1.0.0.post1 This release

2 files

1.0.0

2 files

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page