Skip to main content

Real dependency injection in fastapi

Project description

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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

fastapidi-0.1.2.tar.gz (1.8 kB view hashes)

Uploaded Source

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page