Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/dmtrs/dependable

Dependency injection system extracted from FastAPI
https://github.com/dmtrs/dependable

Last synced: about 2 months ago
JSON representation

Dependency injection system extracted from FastAPI

Awesome Lists containing this project

README

        


dependable




Latest Commit






Package version



Dependency injection system extracted from `fastapi`

```python
import asyncio
from random import random

from dependable import dependant, Depends

@dependant
async def main(*, choice: int = Depends(random)) -> None:
print(choice)

asyncio.run(main())
```

More on [examples](examples/tick.py)

## Installation

``` bash
poetry add dependable # pip install dependable
```

## Python 3.6

- Backport require of [async-exit-stack](https://pypi.org/project/async-exit-stack/) and [async_generator](https://pypi.org/project/async_generator/)
```bash
poetry add async-exit-stack async_generator # pip install async-exit-stack async_generator
```

## Development

```bash
docker build -t dependable .
```

```bash
docker run --rm -v $(pwd):/usr/src/app dependable scripts/dev
```

## References

- [tiangolo/fastapi#2967](https://github.com/tiangolo/fastapi/issues/2967)

## License

This project is licensed under the terms of the MIT license.