{"id":23368,"library":"blacksheep","title":"BlackSheep","description":"A fast ASGI web framework for building asynchronous web applications in Python, featuring automatic OpenAPI documentation generation, dependency injection, and built-in HTTP client. Current version 2.6.2, supporting Python 3.10+. Active development with monthly releases on GitHub.","status":"active","version":"2.6.2","language":"python","source_language":"en","source_url":"https://github.com/Neoteroi/BlackSheep","tags":["asgi","async","web-framework","openapi","dependency-injection","http-client"],"install":[{"cmd":"pip install blacksheep","lang":"bash","label":"Default install"}],"dependencies":[{"reason":"HTTP parsing","package":"httptools","optional":false},{"reason":"HTTP client backend","package":"urllib3","optional":false},{"reason":"JWT authentication","package":"blacksheep-jwt","optional":true},{"reason":"JWT encoding/decoding","package":"pyjwt","optional":true}],"imports":[{"note":"In v2.x, Application is directly exposed from the top-level package. Using blacksheep.server was deprecated.","wrong":"from blacksheep.server import Application","symbol":"Application","correct":"from blacksheep import Application"},{"note":"Request and Response are top-level exports since v2.0.","wrong":"from blacksheep.server import Request","symbol":"Request","correct":"from blacksheep import Request"},{"symbol":"Response","correct":"from blacksheep import Response"},{"note":"Route decorators are in routing module, not top-level.","wrong":"from blacksheep import get","symbol":"get","correct":"from blacksheep.server.routing import get"},{"note":"Router is under blacksheep.server.routing.","wrong":"from blacksheep.routing import Router","symbol":"Router","correct":"from blacksheep.server.routing import Router"},{"note":"DI tools are in the blacksheep.server.di submodule.","wrong":"from blacksheep import Inject","symbol":"Inject","correct":"from blacksheep.server.di import Inject"}],"quickstart":{"code":"from blacksheep import Application, Request, Response\nfrom blacksheep.server.routing import get\n\napp = Application()\n\n@get('/')\nasync def home(request: Request) -> str:\n    return 'Hello, World!'\n\n# Run using: uvicorn main:app\n","lang":"python","description":"Minimal BlackSheep app with a single route. Run with uvicorn or hypercorn."},"warnings":[{"fix":"Remove any arguments from Application instantiation.","message":"In v2.0+, the Application class no longer takes an 'app' parameter (previously used for wsgi). Use Application() directly.","severity":"breaking","affected_versions":">=2.0.0"},{"fix":"Update imports to top-level: from blacksheep import Request, Response, Application.","message":"The 'server' module was reorganized in v2.0. Most classes moved out of blacksheep.server to top-level. Importing from blacksheep.server for Request/Response/Application may fail.","severity":"breaking","affected_versions":">=2.0.0"},{"fix":"Define all handlers with async def.","message":"Route handlers must be async functions. Using synchronous functions will cause a runtime error or unexpected behavior.","severity":"gotcha","affected_versions":"all"},{"fix":"Create the client inside an async function or use await client.open_async().","message":"When using the built-in HTTP client, ensure the event loop is running. Instantiating blacksheep.client.Client outside an async context may cause deadlocks.","severity":"gotcha","affected_versions":"all"},{"fix":"Replace auth_mode=... with scheme=... in JWTBearerAuthentication constructor.","message":"The 'auth_mode' parameter in JWTBearerAuthentication is deprecated since v2.4.3. Use 'scheme' instead.","severity":"deprecated","affected_versions":">=2.4.3"}],"env_vars":null,"last_verified":"2026-05-01T00:00:00.000Z","next_check":"2026-07-30T00:00:00.000Z","problems":[{"fix":"Upgrade to latest: pip install --upgrade blacksheep. If still failing, use from blacksheep.server import Application for older versions.","cause":"Installed version is older than v2.0 or import path changed.","error":"ImportError: cannot import name 'Application' from 'blacksheep'"},{"fix":"Ensure handler is async and use @get('/') with parentheses, not @get('/') without calling.","cause":"Using synchronous handler or missing proper route decorator parentheses.","error":"TypeError: 'function' object is not subscriptable"},{"fix":"Use await request.json() or await request.form().","cause":"Calling Request methods like .json() or .form() without await inside async handler.","error":"RuntimeError: You must use `await` on the request body methods"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}