patx/micropie
v0.18 introduces sse friendly response handling
Commit 6dcae34 · patx · 2025-07-09T00:17:16-04:00
Comments
No comments yet.
Diff
diff --git a/docs/release_notes.md b/docs/release_notes.md
index 52f2519..a43eeb7 100644
--- a/docs/release_notes.md
+++ b/docs/release_notes.md
@@ -1,6 +1,7 @@
[](https://patx.github.io/micropie)
## Releases Notes
+- **[0.18](https://github.com/patx/micropie/releases/tag/v0.18)** - Ensure handlers that return async generators are killed upon client disconnect to prevent memory leaks
- **[0.17](https://github.com/patx/micropie/releases/tag/v0.17)** - Change API of lifespan events to match API of middlewaress, eg. `app.startup_handlers.append(handler)`
- **[0.16](https://github.com/patx/micropie/releases/tag/v0.16)** - Add support for lifespan events using `on_startup` and `on_shutdown`
- **[0.15](https://github.com/patx/micropie/releases/tag/v0.15)** - Minor bug fixes in the optional dependencies if statements
diff --git a/micropie.py b/micropie.py
index a317541..4f01d90 100644
--- a/micropie.py
+++ b/micropie.py
@@ -865,6 +865,7 @@ class App:
"status": status_code,
"headers": [(k.encode("latin-1"), v.encode("latin-1")) for k, v in sanitized_headers],
})
+ # Handle async generators (non-SSE cases; SSE is handled in _asgi_app_http)
if hasattr(body, "__aiter__"):
async for chunk in body:
if isinstance(chunk, str):
diff --git a/pyproject.toml b/pyproject.toml
index 58e2ff7..18ac5a3 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -4,7 +4,7 @@ build-backend = "flit_core.buildapi"
[project]
name = "micropie"
-version = "0.17"
+version = "0.18"
description = "An ultra micro ASGI web framework"
keywords = ["micropie", "asgi", "microframework", "http"]
readme = "docs/README.md"