hypercorn icon indicating copy to clipboard operation
hypercorn copied to clipboard

ASGIWrapper: make sync_spawn and call_soon optional

Open mavwolverine opened this issue 1 year ago • 1 comments

https://github.com/pgjones/hypercorn/blob/3fbd5f245e5dfeaba6ad852d9135d6a32b228d05/src/hypercorn/app_wrappers.py#L31

Most asgi middlewares implement __call__ with only 3 params, scope, receive and send.

        sync_spawn: Callable,
        call_soon: Callable,

These are anyways not being used. So making them optional might make it simpler for integration.

        sync_spawn: Callable | None = None,
        call_soon: Callable | None = None,

mavwolverine avatar Feb 10 '24 04:02 mavwolverine

@pgjones thoughts? Thanks

https://github.com/getappmap/appmap-python/issues/251#issuecomment-1936750685

mavwolverine avatar Mar 15 '24 02:03 mavwolverine

ASGIWrapper is not meant to be used as middleware, you can use normal ASGI middleware with Hypercorn though by wrapping the app with it. Is there something about ASGIWrapper you specifically want to use?

pgjones avatar May 26 '24 12:05 pgjones

@pgjones we were trying to integrate Hypercorn in appmap. https://github.com/getappmap/appmap-python/issues/251#issuecomment-1936750685

But they decided to support only uvicorn. So you can close this if you want to.

mavwolverine avatar May 26 '24 22:05 mavwolverine

Ok, for clarity ASGIWrapper is meant for Hypercorn's internal usage. The same ASGI middleware that works with Uvicorn will work with Hypercorn.

pgjones avatar May 27 '24 07:05 pgjones