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.

Metadata

Release files for fastapi-inferring-depends 1.0.0.post1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for fastapi-inferring-depends 1.0.0.post1
File Size Uploaded
fastapi_inferring_depends-1.0.0.post1.tar.gz 2.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for fastapi-inferring-depends 1.0.0.post1
File Interpreter ABI Platform
fastapi_inferring_depends-1.0.0.post1-py3-none-any.whl Python 3 none any Details

Total release size: 5.7 kB

Release files / fastapi_inferring_depends-1.0.0.post1.tar.gz

Download URL fastapi_inferring_depends-1.0.0.post1.tar.gz
Size 2.4 kB
Tags Source
SHA-256 checksum
How to use checksums
c24e8a87971934559e692e8559cb2e76be976578c613473d4f50dcedb5e60cf7
BLAKE2b-256 checksum
How to use checksums
f57d4389678da308871611729578f6f99b7d3583f4b738ba8da701bddf670c45
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.11.3

Release files / fastapi_inferring_depends-1.0.0.post1-py3-none-any.whl

Download URL fastapi_inferring_depends-1.0.0.post1-py3-none-any.whl
Size 3.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
2f47a86493149c1178440e0369605feef1fe6d193c004e432dc28e15449e21be
BLAKE2b-256 checksum
How to use checksums
02df14d1649aef6e1a85098ebf8e080f992a35a0d3085ff00d14368681e73167
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.11.3

Release history Release notifications | RSS feed

This release

1.0.0.post1 This release

2 release files

1.0.0

2 release 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