@formaggio-software/rhtop-windows-amd64 0.0.0-stage → 0.0.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (156) hide show
  1. package/package.json +16 -4
  2. package/payload/LICENSE.txt +95 -0
  3. package/payload/NOTICE +16 -0
  4. package/payload/THIRD_PARTY_NOTICES/altgraph-0.17.5.dist-info/LICENSE +18 -0
  5. package/payload/THIRD_PARTY_NOTICES/altgraph-0.17.5.dist-info/METADATA +307 -0
  6. package/payload/THIRD_PARTY_NOTICES/annotated_types-0.8.0.dist-info/METADATA +295 -0
  7. package/payload/THIRD_PARTY_NOTICES/annotated_types-0.8.0.dist-info/licenses/LICENSE +21 -0
  8. package/payload/THIRD_PARTY_NOTICES/anyio-4.16.0.dist-info/METADATA +108 -0
  9. package/payload/THIRD_PARTY_NOTICES/anyio-4.16.0.dist-info/licenses/LICENSE +20 -0
  10. package/payload/THIRD_PARTY_NOTICES/attrs-26.1.0.dist-info/METADATA +199 -0
  11. package/payload/THIRD_PARTY_NOTICES/attrs-26.1.0.dist-info/licenses/LICENSE +21 -0
  12. package/payload/THIRD_PARTY_NOTICES/backports.tarfile-1.2.0.dist-info/LICENSE +17 -0
  13. package/payload/THIRD_PARTY_NOTICES/backports.tarfile-1.2.0.dist-info/METADATA +46 -0
  14. package/payload/THIRD_PARTY_NOTICES/build-1.6.1.dist-info/METADATA +142 -0
  15. package/payload/THIRD_PARTY_NOTICES/build-1.6.1.dist-info/licenses/LICENSE +20 -0
  16. package/payload/THIRD_PARTY_NOTICES/cffi-2.1.1.dist-info/METADATA +67 -0
  17. package/payload/THIRD_PARTY_NOTICES/cffi-2.1.1.dist-info/licenses/LICENSE +23 -0
  18. package/payload/THIRD_PARTY_NOTICES/click-8.5.1.dist-info/METADATA +83 -0
  19. package/payload/THIRD_PARTY_NOTICES/click-8.5.1.dist-info/licenses/LICENSE.txt +28 -0
  20. package/payload/THIRD_PARTY_NOTICES/colorama-0.4.6.dist-info/METADATA +441 -0
  21. package/payload/THIRD_PARTY_NOTICES/colorama-0.4.6.dist-info/licenses/LICENSE.txt +27 -0
  22. package/payload/THIRD_PARTY_NOTICES/cryptography-50.0.2.dist-info/METADATA +111 -0
  23. package/payload/THIRD_PARTY_NOTICES/cryptography-50.0.2.dist-info/licenses/LICENSE +3 -0
  24. package/payload/THIRD_PARTY_NOTICES/cryptography-50.0.2.dist-info/licenses/LICENSE.APACHE +202 -0
  25. package/payload/THIRD_PARTY_NOTICES/cryptography-50.0.2.dist-info/licenses/LICENSE.BSD +27 -0
  26. package/payload/THIRD_PARTY_NOTICES/h11-0.16.0.dist-info/METADATA +202 -0
  27. package/payload/THIRD_PARTY_NOTICES/h11-0.16.0.dist-info/licenses/LICENSE.txt +22 -0
  28. package/payload/THIRD_PARTY_NOTICES/hatchling-1.33.0.dist-info/METADATA +81 -0
  29. package/payload/THIRD_PARTY_NOTICES/hatchling-1.33.0.dist-info/licenses/LICENSE.txt +9 -0
  30. package/payload/THIRD_PARTY_NOTICES/httpcore2-2.16.2.dist-info/METADATA +798 -0
  31. package/payload/THIRD_PARTY_NOTICES/httpcore2-2.16.2.dist-info/licenses/LICENSE.md +28 -0
  32. package/payload/THIRD_PARTY_NOTICES/httpx2-2.16.2.dist-info/METADATA +227 -0
  33. package/payload/THIRD_PARTY_NOTICES/httpx2-2.16.2.dist-info/licenses/LICENSE.md +13 -0
  34. package/payload/THIRD_PARTY_NOTICES/idna-3.20.dist-info/METADATA +176 -0
  35. package/payload/THIRD_PARTY_NOTICES/idna-3.20.dist-info/licenses/LICENSE.md +31 -0
  36. package/payload/THIRD_PARTY_NOTICES/importlib_metadata-10.2.0.dist-info/METADATA +131 -0
  37. package/payload/THIRD_PARTY_NOTICES/importlib_metadata-10.2.0.dist-info/licenses/LICENSE +73 -0
  38. package/payload/THIRD_PARTY_NOTICES/iniconfig-2.3.1.dist-info/METADATA +84 -0
  39. package/payload/THIRD_PARTY_NOTICES/iniconfig-2.3.1.dist-info/licenses/LICENSE +21 -0
  40. package/payload/THIRD_PARTY_NOTICES/jaraco.classes-3.4.0.dist-info/LICENSE +17 -0
  41. package/payload/THIRD_PARTY_NOTICES/jaraco.classes-3.4.0.dist-info/METADATA +60 -0
  42. package/payload/THIRD_PARTY_NOTICES/jaraco_context-6.1.2.dist-info/METADATA +81 -0
  43. package/payload/THIRD_PARTY_NOTICES/jaraco_context-6.1.2.dist-info/licenses/LICENSE +18 -0
  44. package/payload/THIRD_PARTY_NOTICES/jaraco_functools-4.6.0.dist-info/METADATA +68 -0
  45. package/payload/THIRD_PARTY_NOTICES/jaraco_functools-4.6.0.dist-info/licenses/LICENSE +18 -0
  46. package/payload/THIRD_PARTY_NOTICES/jsonschema-4.26.0.dist-info/METADATA +170 -0
  47. package/payload/THIRD_PARTY_NOTICES/jsonschema-4.26.0.dist-info/licenses/COPYING +19 -0
  48. package/payload/THIRD_PARTY_NOTICES/jsonschema_specifications-2025.9.1.dist-info/METADATA +54 -0
  49. package/payload/THIRD_PARTY_NOTICES/jsonschema_specifications-2025.9.1.dist-info/licenses/COPYING +19 -0
  50. package/payload/THIRD_PARTY_NOTICES/keyring-25.7.0.dist-info/METADATA +554 -0
  51. package/payload/THIRD_PARTY_NOTICES/keyring-25.7.0.dist-info/licenses/LICENSE +18 -0
  52. package/payload/THIRD_PARTY_NOTICES/lazy_importer-0.1.0.dist-info/METADATA +174 -0
  53. package/payload/THIRD_PARTY_NOTICES/lazy_importer-0.1.0.dist-info/licenses/LICENSE +202 -0
  54. package/payload/THIRD_PARTY_NOTICES/linkify_it_py-2.2.0.dist-info/METADATA +262 -0
  55. package/payload/THIRD_PARTY_NOTICES/linkify_it_py-2.2.0.dist-info/licenses/LICENSE +48 -0
  56. package/payload/THIRD_PARTY_NOTICES/markdown_it_py-4.3.0.dist-info/METADATA +237 -0
  57. package/payload/THIRD_PARTY_NOTICES/markdown_it_py-4.3.0.dist-info/licenses/LICENSE +21 -0
  58. package/payload/THIRD_PARTY_NOTICES/markdown_it_py-4.3.0.dist-info/licenses/LICENSE.markdown-it +22 -0
  59. package/payload/THIRD_PARTY_NOTICES/mcp-2.3.0.dist-info/METADATA +172 -0
  60. package/payload/THIRD_PARTY_NOTICES/mcp-2.3.0.dist-info/licenses/LICENSE +21 -0
  61. package/payload/THIRD_PARTY_NOTICES/mcp_types-2.3.0.dist-info/METADATA +43 -0
  62. package/payload/THIRD_PARTY_NOTICES/mcp_types-2.3.0.dist-info/licenses/LICENSE +21 -0
  63. package/payload/THIRD_PARTY_NOTICES/mdit_py_plugins-0.7.0.dist-info/METADATA +60 -0
  64. package/payload/THIRD_PARTY_NOTICES/mdit_py_plugins-0.7.0.dist-info/licenses/LICENSE +21 -0
  65. package/payload/THIRD_PARTY_NOTICES/mdurl-0.1.2.dist-info/LICENSE +46 -0
  66. package/payload/THIRD_PARTY_NOTICES/mdurl-0.1.2.dist-info/METADATA +32 -0
  67. package/payload/THIRD_PARTY_NOTICES/more_itertools-11.2.1.dist-info/METADATA +302 -0
  68. package/payload/THIRD_PARTY_NOTICES/more_itertools-11.2.1.dist-info/licenses/LICENSE +19 -0
  69. package/payload/THIRD_PARTY_NOTICES/opentelemetry_api-1.45.2.dist-info/METADATA +43 -0
  70. package/payload/THIRD_PARTY_NOTICES/opentelemetry_api-1.45.2.dist-info/licenses/LICENSE +201 -0
  71. package/payload/THIRD_PARTY_NOTICES/packaging-26.3.dist-info/METADATA +112 -0
  72. package/payload/THIRD_PARTY_NOTICES/packaging-26.3.dist-info/licenses/LICENSE +3 -0
  73. package/payload/THIRD_PARTY_NOTICES/packaging-26.3.dist-info/licenses/LICENSE.APACHE +177 -0
  74. package/payload/THIRD_PARTY_NOTICES/packaging-26.3.dist-info/licenses/LICENSE.BSD +23 -0
  75. package/payload/THIRD_PARTY_NOTICES/pathspec-1.1.1.dist-info/METADATA +392 -0
  76. package/payload/THIRD_PARTY_NOTICES/pathspec-1.1.1.dist-info/licenses/LICENSE +373 -0
  77. package/payload/THIRD_PARTY_NOTICES/pefile-2024.8.26.dist-info/LICENSE +21 -0
  78. package/payload/THIRD_PARTY_NOTICES/pefile-2024.8.26.dist-info/METADATA +34 -0
  79. package/payload/THIRD_PARTY_NOTICES/pip-23.2.1.dist-info/LICENSE.txt +20 -0
  80. package/payload/THIRD_PARTY_NOTICES/pip-23.2.1.dist-info/METADATA +90 -0
  81. package/payload/THIRD_PARTY_NOTICES/platformdirs-4.14.7.dist-info/METADATA +114 -0
  82. package/payload/THIRD_PARTY_NOTICES/platformdirs-4.14.7.dist-info/licenses/LICENSE +21 -0
  83. package/payload/THIRD_PARTY_NOTICES/pluggy-1.7.0.dist-info/METADATA +152 -0
  84. package/payload/THIRD_PARTY_NOTICES/pluggy-1.7.0.dist-info/licenses/LICENSE +21 -0
  85. package/payload/THIRD_PARTY_NOTICES/pycparser-3.12.dist-info/METADATA +286 -0
  86. package/payload/THIRD_PARTY_NOTICES/pycparser-3.12.dist-info/licenses/LICENSE +27 -0
  87. package/payload/THIRD_PARTY_NOTICES/pydantic-2.14.3.dist-info/METADATA +1646 -0
  88. package/payload/THIRD_PARTY_NOTICES/pydantic-2.14.3.dist-info/licenses/LICENSE +21 -0
  89. package/payload/THIRD_PARTY_NOTICES/pydantic_core-2.50.4.dist-info/METADATA +172 -0
  90. package/payload/THIRD_PARTY_NOTICES/pydantic_core-2.50.4.dist-info/licenses/LICENSE +21 -0
  91. package/payload/THIRD_PARTY_NOTICES/pygments-2.21.0.dist-info/METADATA +58 -0
  92. package/payload/THIRD_PARTY_NOTICES/pygments-2.21.0.dist-info/licenses/AUTHORS +296 -0
  93. package/payload/THIRD_PARTY_NOTICES/pygments-2.21.0.dist-info/licenses/LICENSE +25 -0
  94. package/payload/THIRD_PARTY_NOTICES/pyinstaller-6.22.3.dist-info/METADATA +213 -0
  95. package/payload/THIRD_PARTY_NOTICES/pyinstaller-6.22.3.dist-info/licenses/COPYING.txt +648 -0
  96. package/payload/THIRD_PARTY_NOTICES/pyinstaller_hooks_contrib-2026.10.dist-info/METADATA +373 -0
  97. package/payload/THIRD_PARTY_NOTICES/pyinstaller_hooks_contrib-2026.10.dist-info/licenses/LICENSE +521 -0
  98. package/payload/THIRD_PARTY_NOTICES/pyjwt-2.15.1.dist-info/METADATA +94 -0
  99. package/payload/THIRD_PARTY_NOTICES/pyjwt-2.15.1.dist-info/licenses/AUTHORS.rst +7 -0
  100. package/payload/THIRD_PARTY_NOTICES/pyjwt-2.15.1.dist-info/licenses/LICENSE +21 -0
  101. package/payload/THIRD_PARTY_NOTICES/pyproject_hooks-1.3.3.dist-info/METADATA +27 -0
  102. package/payload/THIRD_PARTY_NOTICES/pyproject_hooks-1.3.3.dist-info/licenses/LICENSE +21 -0
  103. package/payload/THIRD_PARTY_NOTICES/pytest-9.2.0.dist-info/METADATA +217 -0
  104. package/payload/THIRD_PARTY_NOTICES/pytest-9.2.0.dist-info/licenses/LICENSE +21 -0
  105. package/payload/THIRD_PARTY_NOTICES/pytest_asyncio-1.5.0.dist-info/METADATA +100 -0
  106. package/payload/THIRD_PARTY_NOTICES/pytest_asyncio-1.5.0.dist-info/licenses/LICENSE +201 -0
  107. package/payload/THIRD_PARTY_NOTICES/python_multipart-0.0.34.dist-info/METADATA +179 -0
  108. package/payload/THIRD_PARTY_NOTICES/python_multipart-0.0.34.dist-info/licenses/LICENSE.txt +202 -0
  109. package/payload/THIRD_PARTY_NOTICES/pywin32-312.dist-info/METADATA +261 -0
  110. package/payload/THIRD_PARTY_NOTICES/pywin32-312.dist-info/licenses/adodbapi/license.txt +505 -0
  111. package/payload/THIRD_PARTY_NOTICES/pywin32-312.dist-info/licenses/com/License.txt +30 -0
  112. package/payload/THIRD_PARTY_NOTICES/pywin32-312.dist-info/licenses/com/win32comext/mapi/src/MAPIStubLibrary/LICENSE +21 -0
  113. package/payload/THIRD_PARTY_NOTICES/pywin32-312.dist-info/licenses/isapi/README.txt +7 -0
  114. package/payload/THIRD_PARTY_NOTICES/pywin32-312.dist-info/licenses/pythonwin/License.txt +30 -0
  115. package/payload/THIRD_PARTY_NOTICES/pywin32-312.dist-info/licenses/pythonwin/Scintilla/License.txt +20 -0
  116. package/payload/THIRD_PARTY_NOTICES/pywin32-312.dist-info/licenses/pythonwin/pywin/idle/LICENSE.txt +246 -0
  117. package/payload/THIRD_PARTY_NOTICES/pywin32-312.dist-info/licenses/win32/License.txt +30 -0
  118. package/payload/THIRD_PARTY_NOTICES/pywin32_ctypes-0.2.3.dist-info/LICENSE.txt +28 -0
  119. package/payload/THIRD_PARTY_NOTICES/pywin32_ctypes-0.2.3.dist-info/METADATA +134 -0
  120. package/payload/THIRD_PARTY_NOTICES/pywinpty-3.1.2.dist-info/METADATA +162 -0
  121. package/payload/THIRD_PARTY_NOTICES/pywinpty-3.1.2.dist-info/licenses/LICENSE.txt +21 -0
  122. package/payload/THIRD_PARTY_NOTICES/pyyaml-6.0.3.dist-info/METADATA +59 -0
  123. package/payload/THIRD_PARTY_NOTICES/pyyaml-6.0.3.dist-info/licenses/LICENSE +20 -0
  124. package/payload/THIRD_PARTY_NOTICES/referencing-0.37.0.dist-info/METADATA +64 -0
  125. package/payload/THIRD_PARTY_NOTICES/referencing-0.37.0.dist-info/licenses/COPYING +19 -0
  126. package/payload/THIRD_PARTY_NOTICES/rich-15.0.0.dist-info/METADATA +479 -0
  127. package/payload/THIRD_PARTY_NOTICES/rich-15.0.0.dist-info/licenses/LICENSE +19 -0
  128. package/payload/THIRD_PARTY_NOTICES/rpds_py-2026.9.1.dist-info/METADATA +99 -0
  129. package/payload/THIRD_PARTY_NOTICES/rpds_py-2026.9.1.dist-info/licenses/LICENSE +19 -0
  130. package/payload/THIRD_PARTY_NOTICES/ruff-0.17.5.dist-info/METADATA +484 -0
  131. package/payload/THIRD_PARTY_NOTICES/ruff-0.17.5.dist-info/licenses/LICENSE +430 -0
  132. package/payload/THIRD_PARTY_NOTICES/setuptools-65.5.0.dist-info/LICENSE +19 -0
  133. package/payload/THIRD_PARTY_NOTICES/setuptools-65.5.0.dist-info/METADATA +144 -0
  134. package/payload/THIRD_PARTY_NOTICES/sse_starlette-3.7.0.dist-info/METADATA +493 -0
  135. package/payload/THIRD_PARTY_NOTICES/sse_starlette-3.7.0.dist-info/licenses/AUTHORS +10 -0
  136. package/payload/THIRD_PARTY_NOTICES/sse_starlette-3.7.0.dist-info/licenses/LICENSE +27 -0
  137. package/payload/THIRD_PARTY_NOTICES/starlette-1.10.0.dist-info/METADATA +181 -0
  138. package/payload/THIRD_PARTY_NOTICES/starlette-1.10.0.dist-info/licenses/LICENSE.md +27 -0
  139. package/payload/THIRD_PARTY_NOTICES/textual-6.12.0.dist-info/LICENSE +21 -0
  140. package/payload/THIRD_PARTY_NOTICES/textual-6.12.0.dist-info/METADATA +265 -0
  141. package/payload/THIRD_PARTY_NOTICES/tomlkit-0.15.2.dist-info/METADATA +93 -0
  142. package/payload/THIRD_PARTY_NOTICES/tomlkit-0.15.2.dist-info/licenses/LICENSE +20 -0
  143. package/payload/THIRD_PARTY_NOTICES/trove_classifiers-2026.9.21.13.dist-info/METADATA +82 -0
  144. package/payload/THIRD_PARTY_NOTICES/trove_classifiers-2026.9.21.13.dist-info/licenses/LICENSE +201 -0
  145. package/payload/THIRD_PARTY_NOTICES/truststore-0.10.5.dist-info/METADATA +110 -0
  146. package/payload/THIRD_PARTY_NOTICES/truststore-0.10.5.dist-info/licenses/LICENSE +21 -0
  147. package/payload/THIRD_PARTY_NOTICES/typing_extensions-4.16.0.dist-info/METADATA +73 -0
  148. package/payload/THIRD_PARTY_NOTICES/typing_extensions-4.16.0.dist-info/licenses/LICENSE +279 -0
  149. package/payload/THIRD_PARTY_NOTICES/typing_inspection-0.4.5.dist-info/METADATA +49 -0
  150. package/payload/THIRD_PARTY_NOTICES/typing_inspection-0.4.5.dist-info/licenses/LICENSE +21 -0
  151. package/payload/THIRD_PARTY_NOTICES/uvicorn-0.54.0.dist-info/METADATA +189 -0
  152. package/payload/THIRD_PARTY_NOTICES/uvicorn-0.54.0.dist-info/licenses/LICENSE.md +27 -0
  153. package/payload/THIRD_PARTY_NOTICES/zipp-4.1.2.dist-info/METADATA +108 -0
  154. package/payload/THIRD_PARTY_NOTICES/zipp-4.1.2.dist-info/licenses/LICENSE +18 -0
  155. package/payload/rhtop.exe +0 -0
  156. package/README.md +0 -3
@@ -0,0 +1,493 @@
1
+ Metadata-Version: 2.4
2
+ Name: sse-starlette
3
+ Version: 3.7.0
4
+ Summary: SSE plugin for Starlette
5
+ Author-email: sysid <sysid@gmx.de>
6
+ License-Expression: BSD-3-Clause
7
+ Project-URL: Homepage, https://github.com/sysid/sse-starlette
8
+ Project-URL: Repository, https://github.com/sysid/sse-starlette
9
+ Project-URL: Issues, https://github.com/sysid/sse-starlette/issues
10
+ Project-URL: Source, https://github.com/sysid/sse-starlette
11
+ Classifier: Development Status :: 5 - Production/Stable
12
+ Classifier: Environment :: Web Environment
13
+ Classifier: Intended Audience :: Developers
14
+ Classifier: Operating System :: OS Independent
15
+ Classifier: Programming Language :: Python :: 3
16
+ Classifier: Programming Language :: Python :: 3.11
17
+ Classifier: Programming Language :: Python :: 3.12
18
+ Classifier: Programming Language :: Python :: 3.13
19
+ Classifier: Programming Language :: Python :: 3.14
20
+ Classifier: Programming Language :: Python :: 3.15
21
+ Classifier: Topic :: Internet :: WWW/HTTP
22
+ Requires-Python: >=3.11
23
+ Description-Content-Type: text/markdown
24
+ License-File: LICENSE
25
+ License-File: AUTHORS
26
+ Requires-Dist: starlette>=0.49.1
27
+ Requires-Dist: anyio>=4.7.0
28
+ Provides-Extra: examples
29
+ Requires-Dist: uvicorn>=0.34.0; extra == "examples"
30
+ Requires-Dist: fastapi>=0.115.12; extra == "examples"
31
+ Requires-Dist: pydantic>=2; extra == "examples"
32
+ Provides-Extra: examples-db
33
+ Requires-Dist: sqlalchemy[asyncio]>=2.0.41; extra == "examples-db"
34
+ Requires-Dist: aiosqlite>=0.21.0; extra == "examples-db"
35
+ Provides-Extra: uvicorn
36
+ Requires-Dist: uvicorn>=0.34.0; extra == "uvicorn"
37
+ Provides-Extra: granian
38
+ Requires-Dist: granian>=2.3.1; extra == "granian"
39
+ Provides-Extra: daphne
40
+ Requires-Dist: daphne>=4.2.0; extra == "daphne"
41
+ Dynamic: license-file
42
+
43
+ # Server-Sent Events for [Starlette](https://github.com/encode/starlette) and [FastAPI](https://fastapi.tiangolo.com/)
44
+
45
+ [![Downloads](https://static.pepy.tech/badge/sse-starlette/week)](https://pepy.tech/project/sse-starlette)
46
+ [![PyPI Version][pypi-image]][pypi-url]
47
+ [![Build Status][build-image]][build-url]
48
+
49
+ > Background: https://sysid.github.io/server-sent-events/
50
+
51
+ Production ready Server-Sent Events implementation for Starlette and FastAPI following the [W3C SSE specification](https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events).
52
+
53
+ ## Installation
54
+
55
+ ```bash
56
+ pip install sse-starlette
57
+ uv add sse-starlette
58
+
59
+ # To run the examples (fastapi, uvicorn, pydantic)
60
+ uv add sse-starlette[examples]
61
+
62
+ # Example 03 also needs the DB extras (sqlalchemy, aiosqlite)
63
+ uv add sse-starlette[examples,examples-db]
64
+
65
+ # Recommended ASGI server
66
+ uv add sse-starlette[uvicorn,granian,daphne]
67
+ ```
68
+
69
+ ## Quick Start
70
+
71
+ ```python
72
+ import asyncio
73
+ from starlette.applications import Starlette
74
+ from starlette.routing import Route
75
+ from sse_starlette import EventSourceResponse
76
+
77
+ async def generate_events():
78
+ for i in range(10):
79
+ yield {"data": f"Event {i}"}
80
+ await asyncio.sleep(1)
81
+
82
+ async def sse_endpoint(request):
83
+ return EventSourceResponse(generate_events())
84
+
85
+ app = Starlette(routes=[Route("/events", sse_endpoint)])
86
+ ```
87
+
88
+ ## Core Features
89
+
90
+ - **Standards Compliant**: Full SSE specification implementation
91
+ - **Framework Integration**: Native Starlette and FastAPI support
92
+ - **Async/Await**: Built on modern Python async patterns
93
+ - **Connection Management**: Automatic client disconnect detection
94
+ - **Graceful Shutdown**: Proper cleanup on server termination with cooperative shutdown support
95
+ - **Thread Safety**: Context-local event management for multi-threaded applications
96
+ - **Multi-Loop Support**: Works correctly with multiple asyncio event loops
97
+
98
+ For a detailed look at the internal task coordination, shutdown detection, and cancellation
99
+ flows, see [ARCHITECTURE.md](ARCHITECTURE.md).
100
+
101
+ ## Key Components
102
+
103
+ ### EventSourceResponse
104
+
105
+ The main response class that handles SSE streaming:
106
+
107
+ ```python
108
+ from sse_starlette import EventSourceResponse
109
+
110
+ # Basic usage
111
+ async def stream_data():
112
+ for item in data:
113
+ yield {"data": item, "event": "update", "id": str(item.id)}
114
+
115
+ return EventSourceResponse(stream_data())
116
+ ```
117
+
118
+ ### ServerSentEvent
119
+
120
+ For structured event creation:
121
+
122
+ ```python
123
+ from sse_starlette import ServerSentEvent
124
+
125
+ event = ServerSentEvent(
126
+ data="Custom message",
127
+ event="notification",
128
+ id="msg-123",
129
+ retry=5000
130
+ )
131
+ ```
132
+
133
+ ### JSONServerSentEvent
134
+
135
+ For an easy way to send json data as SSE events:
136
+
137
+ ```python
138
+ from sse_starlette import JSONServerSentEvent
139
+
140
+ event = JSONServerSentEvent(
141
+ data={"field":"value"}, # Anything serializable with json.dumps
142
+ )
143
+ ```
144
+
145
+ ## Advanced Usage
146
+
147
+ ### Custom Ping Configuration
148
+
149
+ ```python
150
+ from sse_starlette import ServerSentEvent
151
+
152
+ def custom_ping():
153
+ return ServerSentEvent(comment="Custom ping message")
154
+
155
+ return EventSourceResponse(
156
+ generate_events(),
157
+ ping=10, # Ping every 10 seconds
158
+ ping_message_factory=custom_ping
159
+ )
160
+ ```
161
+
162
+ ### Multi-Threaded Usage
163
+
164
+ sse-starlette now supports usage in multi-threaded applications and with multiple asyncio event loops:
165
+
166
+ ```python
167
+ import threading
168
+ import asyncio
169
+ from sse_starlette import EventSourceResponse
170
+
171
+ def run_sse_in_thread():
172
+ """SSE streaming works correctly in separate threads"""
173
+ loop = asyncio.new_event_loop()
174
+ asyncio.set_event_loop(loop)
175
+
176
+ async def thread_events():
177
+ for i in range(5):
178
+ yield {"data": f"Thread event {i}"}
179
+ await asyncio.sleep(1)
180
+
181
+ # This works without "Event bound to different loop" errors
182
+ response = EventSourceResponse(thread_events())
183
+ loop.close()
184
+
185
+ # Start SSE in multiple threads
186
+ for i in range(3):
187
+ thread = threading.Thread(target=run_sse_in_thread)
188
+ thread.start()
189
+ ```
190
+
191
+ ### Database Streaming (Thread-Safe)
192
+
193
+ ```python
194
+ async def stream_database_results(request):
195
+ # CORRECT: Create session within generator context
196
+ async with AsyncSession() as session:
197
+ results = await session.execute(select(User))
198
+ for row in results:
199
+ if await request.is_disconnected():
200
+ break
201
+ yield {"data": row.name, "id": str(row.id)}
202
+
203
+ return EventSourceResponse(stream_database_results(request))
204
+ ```
205
+
206
+ ### Error Handling and Timeouts
207
+
208
+ ```python
209
+ async def robust_stream(request):
210
+ try:
211
+ for i in range(100):
212
+ if await request.is_disconnected():
213
+ break
214
+ yield {"data": f"Item {i}"}
215
+ await asyncio.sleep(0.5)
216
+ except asyncio.CancelledError:
217
+ # Client disconnected - perform cleanup
218
+ raise
219
+
220
+ return EventSourceResponse(
221
+ robust_stream(request),
222
+ send_timeout=30, # Timeout hanging sends
223
+ headers={"Cache-Control": "no-cache"}
224
+ )
225
+ ```
226
+
227
+ ### Memory Channels Alternative
228
+
229
+ For complex data flows, use memory channels instead of generators:
230
+
231
+ ```python
232
+ import anyio
233
+ from functools import partial
234
+
235
+ async def data_producer(send_channel):
236
+ async with send_channel:
237
+ for i in range(10):
238
+ await send_channel.send({"data": f"Item {i}"})
239
+ await anyio.sleep(1)
240
+
241
+ async def channel_endpoint(request):
242
+ send_channel, receive_channel = anyio.create_memory_object_stream(10)
243
+
244
+ return EventSourceResponse(
245
+ receive_channel,
246
+ data_sender_callable=partial(data_producer, send_channel)
247
+ )
248
+ ```
249
+
250
+ ### Cooperative Shutdown
251
+
252
+ By default, generators receive `CancelledError` immediately when the server shuts down. With
253
+ cooperative shutdown, generators can detect the shutdown signal, send farewell events to clients,
254
+ and exit gracefully within a configurable grace period.
255
+
256
+ ```python
257
+ import anyio
258
+ from sse_starlette import EventSourceResponse
259
+
260
+ async def graceful_stream(request):
261
+ shutdown_event = anyio.Event()
262
+
263
+ async def generate():
264
+ try:
265
+ while not shutdown_event.is_set():
266
+ yield {"data": "tick"}
267
+ # Check for shutdown between iterations
268
+ with anyio.move_on_after(1.0):
269
+ await shutdown_event.wait()
270
+ # Shutdown detected — send farewell event
271
+ yield {"event": "shutdown", "data": "Server is shutting down"}
272
+ except anyio.get_cancelled_exc_class():
273
+ # Grace period expired — generator force-cancelled
274
+ raise
275
+
276
+ return EventSourceResponse(
277
+ generate(),
278
+ shutdown_event=shutdown_event, # Library sets this on shutdown
279
+ shutdown_grace_period=5.0, # Seconds to wait before force-cancel
280
+ )
281
+ ```
282
+
283
+ **How it works:**
284
+
285
+ 1. On server shutdown, the library sets your `shutdown_event`
286
+ 2. Your generator sees the event and can yield final events
287
+ 3. If the generator exits within `shutdown_grace_period`, shutdown is clean (no `CancelledError`)
288
+ 4. If the generator doesn't exit in time, it is force-cancelled as before
289
+
290
+ **Important:** `shutdown_grace_period` should be less than your ASGI server's graceful shutdown
291
+ timeout (e.g. uvicorn's `--timeout-graceful-shutdown`), otherwise the process is killed before the
292
+ grace period expires.
293
+
294
+ Without `shutdown_event` (the default), behavior is identical to previous versions: immediate
295
+ cancellation on server shutdown.
296
+
297
+ ## Configuration Options
298
+
299
+ ### EventSourceResponse Parameters
300
+
301
+ | Parameter | Type | Default | Description |
302
+ |-----------|------|---------|-------------|
303
+ | `content` | `ContentStream` | Required | Async generator or iterable |
304
+ | `ping` | `int` | 15 | Ping interval in seconds (`0` disables keep-alive pings) |
305
+ | `sep` | `str` | `"\r\n"` | Line separator (`\r\n`, `\r`, `\n`) |
306
+ | `send_timeout` | `float` | `None` | Send operation timeout in seconds |
307
+ | `headers` | `dict` | `None` | Additional HTTP headers |
308
+ | `ping_message_factory` | `Callable` | `None` | Custom ping message creator |
309
+ | `shutdown_event` | `anyio.Event` | `None` | Event set by library on server shutdown |
310
+ | `shutdown_grace_period` | `float` | `0` | Seconds to wait after setting `shutdown_event` before force-cancel |
311
+ | `cleanup_timeout` | `float` | `30.0` | Seconds to wait for the generator's cleanup after an encoding failure or interrupted send, then cancel it and log a warning (`None` = no limit). Cannot stop a nested shield or a blocking call |
312
+
313
+ ### Client Disconnection
314
+
315
+ ```python
316
+ async def monitored_stream(request):
317
+ events_sent = 0
318
+ try:
319
+ while events_sent < 100:
320
+ if await request.is_disconnected():
321
+ print(f"Client disconnected after {events_sent} events")
322
+ break
323
+
324
+ yield {"data": f"Event {events_sent}"}
325
+ events_sent += 1
326
+ await asyncio.sleep(1)
327
+
328
+ except asyncio.CancelledError:
329
+ print("Stream cancelled")
330
+ raise
331
+ ```
332
+
333
+ ## Testing
334
+
335
+ Shutdown state is kept per thread and per server, so tests need no manual reset in the common case. That includes suites that start a real uvicorn server per test and stop it programmatically (`server.should_exit = True`): a stopped server does not affect streams served by a later one in the same process.
336
+
337
+ One exception: a real `SIGTERM`/`SIGINT` delivered to the process sets the process-wide `AppStatus.should_exit`, and nothing clears it (the process is expected to exit). If your tests send real signals to an in-process server and keep running, reset the flag between tests:
338
+
339
+ ```python
340
+ import pytest
341
+ from sse_starlette.sse import AppStatus
342
+
343
+ @pytest.fixture(autouse=True)
344
+ def reset_sse_app_status():
345
+ yield
346
+ AppStatus.should_exit = False
347
+ ```
348
+
349
+ ## Production Considerations
350
+
351
+ ### Performance Limits
352
+
353
+ - **Memory**: Each connection maintains a buffer. Monitor memory usage.
354
+ - **Connections**: Limited by system file descriptors and application design.
355
+ - **Network**: High-frequency events can saturate bandwidth.
356
+
357
+ ### Error Recovery
358
+
359
+ Implement client-side reconnection logic:
360
+
361
+ ```javascript
362
+ function createEventSource(url) {
363
+ const eventSource = new EventSource(url);
364
+
365
+ eventSource.onerror = function() {
366
+ setTimeout(() => {
367
+ createEventSource(url); // Reconnect after delay
368
+ }, 5000);
369
+ };
370
+
371
+ return eventSource;
372
+ }
373
+ ```
374
+
375
+ ## Learning Resources
376
+
377
+ ### Examples Directory
378
+
379
+ The `examples/` directory contains production-ready patterns:
380
+
381
+ - **`01_basic_sse.py`**: Fundamental SSE concepts
382
+ - **`02_message_broadcasting.py`**: Multi-client message distribution
383
+ - **`03_database_streaming.py`**: Thread-safe database integration
384
+ - **`04_advanced_features.py`**: Custom protocols and error handling
385
+
386
+ ### Demonstrations Directory
387
+
388
+ The `examples/demonstrations/` directory provides educational scenarios:
389
+
390
+ **Basic Patterns** (`basic_patterns/`):
391
+ - Client disconnect detection and cleanup
392
+ - Graceful server shutdown behavior
393
+
394
+ **Production Scenarios** (`production_scenarios/`):
395
+ - Load testing with concurrent clients
396
+ - Network interruption handling
397
+
398
+ **Advanced Patterns** (`advanced_patterns/`):
399
+ - Memory channels vs generators
400
+ - Error recovery and circuit breakers
401
+ - Custom protocol development
402
+
403
+ Run any demonstration:
404
+ ```bash
405
+ python examples/demonstrations/basic_patterns/client_disconnect.py
406
+ python examples/demonstrations/production_scenarios/load_simulations.py
407
+ python examples/demonstrations/advanced_patterns/error_recovery.py
408
+ ```
409
+
410
+ ## Troubleshooting
411
+
412
+ ### Common Issues
413
+
414
+ **Database session errors with async generators**
415
+ - Create database sessions inside generators, not as dependencies
416
+
417
+ **Hanging connections after client disconnect**
418
+ - Always check `await request.is_disconnected()` in loops
419
+ - Use `send_timeout` parameter to detect dead connections
420
+
421
+ If you are using Postman, please see: https://github.com/sysid/sse-starlette/issues/47#issuecomment-1445953826
422
+
423
+ ### Performance Optimization
424
+
425
+ ```python
426
+ # Connection limits
427
+ class ConnectionLimiter:
428
+ def __init__(self, max_connections=100):
429
+ self.semaphore = asyncio.Semaphore(max_connections)
430
+
431
+ async def limited_endpoint(self, request):
432
+ async with self.semaphore:
433
+ return EventSourceResponse(generate_events())
434
+ ```
435
+
436
+ ## Network-Level Gotchas
437
+
438
+ Network infrastructure components can buffer SSE streams, breaking real-time delivery. Here are the most common issues and solutions:
439
+
440
+ ### Reverse Proxy Buffering (Nginx/Apache)
441
+
442
+ **Problem**: Nginx buffers responses by default, delaying SSE events until ~16KB accumulates.
443
+
444
+ **Solution**: Add the `X-Accel-Buffering: no` header.
445
+
446
+ **Nginx Configuration** (if you can't modify app headers):
447
+ ```nginx
448
+ location /events {
449
+ proxy_pass http://localhost:8000;
450
+ proxy_http_version 1.1;
451
+ proxy_set_header Connection '';
452
+ proxy_buffering off; # Disable for this location
453
+ chunked_transfer_encoding off;
454
+ }
455
+ ```
456
+
457
+ ### CDN Issues
458
+
459
+ **Cloudflare**: Buffers ~100KB before flushing to clients, breaking real-time delivery.
460
+ **Akamai**: Edge servers buffer by default.
461
+
462
+ ### Load Balancer Problems
463
+
464
+ **HAProxy**: Timeout settings must exceed heartbeat frequency.
465
+ ```haproxy
466
+ # Ensure timeouts > ping interval
467
+ timeout client 60s # If ping every 45s
468
+ timeout server 60s
469
+ ```
470
+
471
+ **F5 Load Balancers**: Buffer responses by default.
472
+
473
+ ## Contributing
474
+
475
+ See examples and demonstrations for implementation patterns. Run tests with:
476
+
477
+ ```bash
478
+ make test-unit # Unit tests only (default dev install)
479
+ make test # Unit + docker integration tests
480
+ make test-experimentation # Optional experimentation tests (multi-consumer load tests)
481
+ # Requires the `experimentation` dependency group:
482
+ # uv sync --group experimentation
483
+ ```
484
+
485
+ The `experimentation` group is opt-in (kept out of the default `dev` install) to keep the
486
+ contributor footprint small. See `tests/experimentation/` for the tests it enables.
487
+
488
+ <!-- Badges -->
489
+ [pypi-image]: https://img.shields.io/pypi/v/sse-starlette.svg
490
+ [pypi-url]: https://pypi.org/project/sse-starlette/
491
+ [build-image]: https://github.com/sysid/sse-starlette/actions/workflows/build.yml/badge.svg
492
+ [build-url]: https://github.com/sysid/sse-starlette/actions/workflows/build.yml
493
+
@@ -0,0 +1,10 @@
1
+ sysid <sysid@gmx.de>
2
+ synodriver <diguohuangjiajinweijun@gmail.com>
3
+ Skyler Lewis <sblnog@gmail.com>
4
+ Margret `Pax` Williams <pax.margret@gmail.com>
5
+ nekonoshiri <gexira.halen.toms@gmail.com>
6
+ justindujardin <justin@dujardinconsulting.com>
7
+ Håvard Thom <34199185+havardthom@users.noreply.github.com>
8
+ Vaibhav Mule <vaibhavmule135@gmail.com>
9
+ issmirnov <smirnov_i@tass.ru>
10
+ Cyprien <courtot.c@gmail.com>
@@ -0,0 +1,27 @@
1
+ Copyright © 2020, [sysid](https://sysid.github.io/).
2
+ All rights reserved.
3
+
4
+ Redistribution and use in source and binary forms, with or without
5
+ modification, are permitted provided that the following conditions are met:
6
+
7
+ * Redistributions of source code must retain the above copyright notice, this
8
+ list of conditions and the following disclaimer.
9
+
10
+ * Redistributions in binary form must reproduce the above copyright notice,
11
+ this list of conditions and the following disclaimer in the documentation
12
+ and/or other materials provided with the distribution.
13
+
14
+ * Neither the name of the copyright holder nor the names of its
15
+ contributors may be used to endorse or promote products derived from
16
+ this software without specific prior written permission.
17
+
18
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
19
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
21
+ DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
22
+ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
23
+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
24
+ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
25
+ CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
26
+ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
27
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.