asgi-tools
raw JSON → 2.1.1 verified Fri May 01 auth: no python
ASGI Toolkit for building ASGI web applications and middlewares. Version 2.1.1 supports Python 3.10+. Regular releases, active development.
pip install asgi-tools Common errors
error ImportError: cannot import name 'App' from 'asgi_tools' ↓
cause Package not installed or wrong version (pre-2.0 had App in asgi_tools.app submodule).
fix
Ensure asgi-tools>=2.0 is installed and use 'from asgi_tools import App'
error RuntimeError: 'Router' object has no attribute 'route' ↓
cause Using Router without App; Router is only used inside App.
fix
Use app.route() or Router().route() but the typical pattern is App with .route() decorator.
Warnings
gotcha Import paths changed in 2.0: direct imports from asgi_tools are correct; avoid importing from submodules like asgi_tools.app, asgi_tools.routes, etc. ↓
fix Use from asgi_tools import App, Router, Request, Response
deprecated asgi_tools.ResponseFile is deprecated in 2.0. Use starlette.responses.FileResponse or custom streaming. ↓
fix Migrate to starlette.responses.FileResponse or implement streaming manually.
Imports
- App wrong
from asgi_tools.app import Appcorrectfrom asgi_tools import App - Router wrong
from asgi_tools.routes import Routercorrectfrom asgi_tools import Router
Quickstart
from asgi_tools import App, Request, Response
app = App()
@app.route('/')
async def home(request: Request):
return Response.text('Hello, world!')
# Run with: uvicorn module:app