Registry / web-framework / aiohttp-fast-url-dispatcher

aiohttp-fast-url-dispatcher

JSON →
library0.3.1pypypi✓ verified 51d ago

A faster URL dispatcher for aiohttp web applications. Current version 0.3.1, released July 2024. Replaces aiohttp's built-in URL dispatch with a high-performance alternative. Low release cadence.

web-frameworkhttp-networking
pip install aiohttp-fast-url-dispatcher
Install & Compatibility
Where this runs
tested against v0.3.1 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
glibc
py 3.10
✓ —
✓ 4.7s
py 3.11
✓ —
✓ 3.6s
py 3.12
✓ —
✓ 2.8s
py 3.13
✕ build_error
✕ build_error
py 3.9
✓ —
✓ 5.4s
26MB installed
● package 26MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

FastUrlDispatcher
from aiohttp_fast_url_dispatcher import FastUrlDispatcher
Use the correct import from the package.

Create an aiohttp app and replace the default router dispatcher with FastUrlDispatcher.

from aiohttp import web from aiohttp_fast_url_dispatcher import FastUrlDispatcher app = web.Application() dispatcher = FastUrlDispatcher() async def handler(request): return web.Response(text="Hello, world!") dispatcher.add_get("/", handler) app.router.set_dispatcher(dispatcher) if __name__ == "__main__": web.run_app(app)
Debug
Known issues
deprecatedThe library requires Python <3.10 and <4.0; support for newer Python versions is limited. v0.3.0 added support for newer Python but check compatibility.
fix
Upgrade to v0.3.0+
affects: <0.3.0
gotchaFastUrlDispatcher does not support all aiohttp routing features (e.g., nested routers, middlewares on routes). Only use for simple route tables.
fix
Ensure your app only uses basic route patterns (plain paths, variable parts). Avoid advanced aiohttp routing features.
affects: all
gotchaThe dispatcher must be set before adding routes; otherwise default dispatcher is used.
fix
Call app.router.set_dispatcher(dispatcher) before adding routes, or use dispatcher.add_* methods.
affects: all
Errors
Common errors & fixes
ImportError: cannot import name 'FastUrlDispatcher' from 'aiohttp'
Trying to import from aiohttp instead of the separate package.
fix
pip install aiohttp-fast-url-dispatcher and use 'from aiohttp_fast_url_dispatcher import FastUrlDispatcher'
AttributeError: 'Application' object has no attribute 'router'
Trying to set dispatcher before initializing the aiohttp app correctly.
fix
Ensure you create the app with 'web.Application()' and then call 'app.router.set_dispatcher(dispatcher)'
Upgrade
Version history
0.3.1latest on PyPI
Audit
Dependencies

No dependency data recorded yet.

Agent activity
73 hits · last 30 days
node
12
ahrefsbot
3
Amazon
1
amazonbot
1
bytedance
1
Resources