fastapidi

Real dependency injection in fastapi


Keywords
async, asyncio, dependency-injection, di, fastapi, web
License
MIT
Install
pip install fastapidi==0.1.1

Documentation

FastAPI DI

This library to integrate pyject into fastapi to use di

Install

pip install fastapidi

Using

from fastapidi import FastAPIDI, get_dependency

class 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()