Codync
免費、開源的 1:1 替代方案,取代 Grok Bot 與 Muse。從 iPhone、Mac 或 Linux 桌面將 Claude Code、Codex、Cursor 與 40+ 程式碼代理人作為持續機器人傳訊。群組聊天、主題串…
AI 翻譯
尚未收集儲存庫資訊。
尚未偵測到更新。GitHub 發布版本後會顯示在這裡。
製作者的介紹僅有上面的一句話。 更多詳情請閱讀儲存庫 README。 儲存庫 README ↗
正在載入完整 README。
檢視完整 README ↗Use FastAPI's dependency injection outside of any web/ASGI context.
FastAPI ships a powerful dependency injection system — Depends, sub-dependencies,
yield teardown, per-resolution caching — but it is tightly coupled to the
request/response cycle. fastapi-standalone-di reuses that exact machinery so you
can resolve and invoke your dependencies from plain Python: CLI scripts, workers,
cron jobs, tests — no HTTP server required.
pip install fastapi-standalone-di
# or
uv add fastapi-standalone-di
Resolve any callable that uses Depends(), exactly as FastAPI would:
import asyncio
from fastapi import Depends
from fastapi_standalone_di import FastAPIContainer
def get_settings() -> dict[str, str]:
return {"db_url": "postgres://localhost/app"}
class Database:
def __init__(self, settings: dict[str, str] = Depends(get_settings)) -> None:
self.url = settings["db_url"]
async def main() -> None:
async with FastAPIContainer() as container:
db = await container.get(Database)
print(db.url) # postgres://localhost/app
asyncio.run(main())
Sub-dependencies, yield teardown, caching, scopes, dependency overrides,
registrable interfaces, per-package binding discovery, shared app state,
application-lifetime singletons, loop-safe execution without a threadpool hop,
standalone Request/Response stubs, and query/path/header/cookie parameters are
all covered in the documentation.
Full documentation is available at toilal.github.io/fastapi-standalone-di.
The in-development docs (built from develop) are previewed at
toilal.github.io/fastapi-standalone-di/dev/.
MIT © Rémi Alvergnat