Codync
免费开源的 1:1 Grok Bot 与 Muse 替代方案。可在 iPhone、Mac 或 Linux 桌面上将 Claude 代码、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