¶
Dependency declarations for Python frameworks and tools.
Documentation: https://depende.tiangolo.com
Source Code: https://github.com/tiangolo/depende
depende provides small dependency declarations in the style of FastAPI for reuse by frameworks and tools.
Install¶
uv add depende
Or if using pip:
pip install depende
Usage¶
from depende import Depends, DependsInfo
Depends(...) returns a frozen DependsInfo metadata object with:
dependency: a callable dependency, orNoneuse_cache: whether a framework may reuse the dependency result within its active solving contextscope: an opaque framework-defined string, orNone
The package only declares dependency metadata. It does not solve, execute, cache, inject request data, manage lifecycles, generate OpenAPI, or define framework-specific scopes.
Example¶
from depende import Depends
from typing import Annotated
def get_settings() -> dict[str, str]:
return {"mode": "prod"}
SettingsDep = Annotated[dict[str, str], Depends(get_settings, scope="command")]
Frameworks decide what scope means and how dependency solving works.
License¶
This project is licensed under the terms of the MIT license.