{"id":23350,"library":"baize","title":"Baize","description":"Baize is a powerful and elegant WSGI/ASGI framework/toolkit for Python, providing high-level abstractions for building HTTP applications. It supports both WSGI and ASGI interfaces, includes routing, request/response handling, middleware, and WebSocket support. The current version is 0.23.1, released with a focus on stability and performance. The library follows a semver-like release cadence, with minor releases every few months.","status":"active","version":"0.23.1","language":"python","source_language":"en","source_url":"https://github.com/abersheeran/baize","tags":["wsgi","asgi","web-framework","http","async"],"install":[{"cmd":"pip install baize","lang":"bash","label":"Standard install"}],"dependencies":[],"imports":[{"note":"Baize is the main application class, directly from the top-level package.","wrong":"from baize.app import Baize","symbol":"Baize","correct":"from baize import Baize"},{"note":"Request class is exported from the top-level package since version 0.23.","wrong":"from baize.http import Request","symbol":"Request","correct":"from baize import Request"},{"note":"Response is also exported from the top-level package.","wrong":"from baize.http import Response","symbol":"Response","correct":"from baize import Response"}],"quickstart":{"code":"import os\nfrom baize import Baize, Request, Response\n\napp = Baize()\n\n@app.route(\"/\")\nasync def home(request: Request) -> Response:\n    name = request.query_params.get(\"name\", \"World\")\n    return Response.json({\"message\": f\"Hello, {name}!\"})\n\nif __name__ == \"__main__\":\n    import uvicorn\n    uvicorn.run(app, host=\"0.0.0.0\", port=8000)","lang":"python","description":"A minimal ASGI Baize application with a single route returning a JSON response."},"warnings":[{"fix":"Update imports to match new top-level exports; e.g., 'from baize import Request' instead of 'from baize.http import Request'.","message":"In version 0.23.0, the top-level exports changed. Classes like Request, Response, and Routing are now directly accessible from 'baize' instead of submodules.","severity":"breaking","affected_versions":"<0.23.0"},{"fix":"Replace 'from baize.wsgi import Baize as WSGI' with 'from baize import Baize' and configure the backend using the 'backend' parameter.","message":"The 'baize.wsgi' and 'baize.asgi' submodules are deprecated. Use the unified 'baize.Baize' class instead.","severity":"deprecated","affected_versions":">=0.22.0, <0.23.0"},{"fix":"Ensure route handlers are declared with 'async def' when using the ASGI backend (the default).","message":"Route handlers must be async functions for ASGI. Using synchronous functions will cause runtime 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":"Use 'from baize import Request, Response' instead.","cause":"Trying to import from a submodule that no longer exists in recent versions.","error":"ModuleNotFoundError: No module named 'baize.http'"},{"fix":"Ensure you import Request as a class: 'from baize import Request'.","cause":"Using Request as a function instead of a class. This happens when importing incorrectly.","error":"TypeError: 'Request' object is not callable"},{"fix":"Make all middleware callables async functions when using the ASGI backend.","cause":"Middleware that is not async is registered on an ASGI app.","error":"RuntimeError: You cannot use sync middleware on an ASGI app"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}