{"id":23499,"library":"dapr-ext-fastapi","title":"Dapr FastAPI Extension","description":"The Dapr FastAPI extension integrates Dapr's pub/sub, actors, and bindings with FastAPI applications. Version 1.17.4 supports Python >=3.10, released on 2025-09-12. Release cadence is approximately monthly.","status":"active","version":"1.17.4","language":"python","source_language":"en","source_url":"https://github.com/dapr/python-sdk","tags":["dapr","fastapi","microservices","distributed-systems"],"install":[{"cmd":"pip install dapr-ext-fastapi","lang":"bash","label":"Install from PyPI"}],"dependencies":[{"reason":"Core Dapr SDK required","package":"dapr","optional":false},{"reason":"Web framework dependency","package":"fastapi","optional":false}],"imports":[{"note":"Old import path changed in dapr-ext-fastapi v1.0","wrong":"from dapr.fastapi import DaprApp","symbol":"DaprApp","correct":"from dapr.ext.fastapi import DaprApp"}],"quickstart":{"code":"from fastapi import FastAPI\nfrom dapr.ext.fastapi import DaprApp\n\napp = FastAPI()\ndapr_app = DaprApp(app)\n\n@app.get('/')\ndef read_root():\n    return {'message': 'Hello Dapr'}\n","lang":"python","description":"Minimal FastAPI app with Dapr extension"},"warnings":[{"fix":"Use FastAPI routes with DaprPubSubMiddleware for pub/sub.","message":"In v1.3.0, the subscription decorator changed from @dapr_app.subscribe to @app.post with DaprPubSubMiddleware. Old decorator no longer works.","severity":"breaking","affected_versions":">=1.3.0"},{"fix":"Use DaprApp(app) instead of DaprApp() and then dapr_app.init(app).","message":"dapr_app.init() is deprecated in favor of initializing DaprApp with the FastAPI app directly.","severity":"deprecated","affected_versions":">=1.4.0"},{"fix":"Call dapr_app.register_actor(MyActor) after actor definition.","message":"When using Dapr actors, ensure the actor class is registered with @actor decorator and dapr_app.register_actor is called. Missing registration results in 'Actor not found' errors.","severity":"gotcha","affected_versions":"all"}],"env_vars":null,"last_verified":"2026-05-01T00:00:00.000Z","next_check":"2026-07-30T00:00:00.000Z","problems":[{"fix":"Add dapr_app.register_actor(YourActorClass) after actor definition.","cause":"Actor class not registered with DaprApp.","error":"dapr.exceptions.DaprInternalError: Actor not found"},{"fix":"Use from dapr.ext.fastapi import DaprApp","cause":"Incorrect import path; the module is dapr.ext.fastapi.","error":"ImportError: cannot import name 'DaprApp' from 'dapr.fastapi'"},{"fix":"Only pass the FastAPI app once in the constructor: DaprApp(app).","cause":"Calling dapr_app.init() or re-initializing with a second FastAPI app.","error":"RuntimeError: DaprApp has already been initialized"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}