Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/bloodielie/fastapidi
Real dependency injection in fastapi
https://github.com/bloodielie/fastapidi
async asyncio dependency-injection di fastapi web
Last synced: 24 days ago
JSON representation
Real dependency injection in fastapi
- Host: GitHub
- URL: https://github.com/bloodielie/fastapidi
- Owner: Bloodielie
- License: mit
- Created: 2021-01-03T17:34:50.000Z (about 4 years ago)
- Default Branch: main
- Last Pushed: 2021-01-04T14:03:38.000Z (about 4 years ago)
- Last Synced: 2024-12-15T19:13:29.359Z (26 days ago)
- Topics: async, asyncio, dependency-injection, di, fastapi, web
- Language: Python
- Homepage:
- Size: 3.91 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# FastAPI DI
*This library to integrate [pyject](https://github.com/Bloodielie/pyject) into [fastapi](https://github.com/tiangolo/fastapi) to use di*
## Install
```bash
pip install fastapidi
```## Using
```python
from fastapidi import FastAPIDI, get_dependencyclass Test:
def test(self):
return "123"app = FastAPIDI()
app.container.add_singleton(Test, Test)@app.get("/")
async def test(dependency: Test = get_dependency(Test)):
return dependency.test()
```