streambus 0.1.0__tar.gz

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.
@@ -0,0 +1,23 @@
1
+ name: Release
2
+
3
+ on:
4
+ push:
5
+ tags:
6
+ - "v*"
7
+
8
+ jobs:
9
+ build-and-publish:
10
+ runs-on: ubuntu-latest
11
+ environment: release
12
+ permissions:
13
+ id-token: write
14
+
15
+ steps:
16
+ - uses: actions/checkout@v4
17
+
18
+ - uses: astral-sh/setup-uv@v4
19
+
20
+ - run: uv build
21
+
22
+ - name: Publish to PyPI
23
+ uses: pypa/gh-action-pypi-publish@release/v1
@@ -0,0 +1,116 @@
1
+ # streambus
2
+
3
+ Librería Python para consumir y publicar eventos sobre Redis Streams. Agnóstica de framework.
4
+
5
+ <!-- rule:framework-agnostic -->
6
+ ## Sin dependencias de framework
7
+
8
+ streambus no importa Django, FastAPI, Celery ni ningún otro framework. Solo depende de `redis-py`.
9
+
10
+ El caller es responsable de resolver los valores de configuración (variables de entorno, Django settings, archivos de config) y pasarlos como tipos primitivos a los objetos de streambus. La librería no sabe de dónde vienen.
11
+
12
+ Nunca añadir imports de frameworks externos al paquete `streambus/`.
13
+ <!-- /rule:framework-agnostic -->
14
+
15
+ <!-- rule:event-contract -->
16
+ ## Contrato de eventos
17
+
18
+ Todo evento debe extender `StreamBusEvent`. El publisher rechaza cualquier objeto que no sea una instancia de `StreamBusEvent`. El listener valida en construcción que `event_class` sea una subclase.
19
+
20
+ ```python
21
+ from dataclasses import dataclass
22
+ from streambus import StreamBusEvent
23
+
24
+ @dataclass(kw_only=True)
25
+ class ClientEvent(StreamBusEvent):
26
+ client_id: str
27
+ name: str
28
+ ```
29
+
30
+ `StreamBusEvent` define dos campos base:
31
+ - `event_type: str` — obligatorio, identifica el tipo de evento.
32
+ - `occurred_at: str` — timestamp ISO 8601, se genera automáticamente si no se pasa.
33
+
34
+ Cualquier campo adicional lo define la subclase. Los campos del stream que no estén declarados en la subclase se descartan en `from_dict`.
35
+ <!-- /rule:event-contract -->
36
+
37
+ <!-- rule:no-field-defaults -->
38
+ ## Sin valores por defecto en campos de dominio
39
+
40
+ Los campos de las subclases de `StreamBusEvent` no llevan valor por defecto. El caller debe pasarlos explícitamente. Esto fuerza que los eventos sean siempre completos y evita estados ambiguos.
41
+
42
+ Correcto:
43
+ ```python
44
+ @dataclass(kw_only=True)
45
+ class ClientEvent(StreamBusEvent):
46
+ client_id: str
47
+ name: str
48
+ is_active: str
49
+ ```
50
+
51
+ Incorrecto:
52
+ ```python
53
+ @dataclass(kw_only=True)
54
+ class ClientEvent(StreamBusEvent):
55
+ client_id: str = "" # ← no
56
+ name: str = "" # ← no
57
+ ```
58
+
59
+ La excepción son los campos de configuración interna de la librería: `occurred_at` en `StreamBusEvent` y los timeouts de socket en `RedisConfig`. Estos tienen defaults porque son detalles de infraestructura, no datos de dominio.
60
+ <!-- /rule:no-field-defaults -->
61
+
62
+ <!-- rule:kw-only -->
63
+ ## kw_only=True obligatorio en todas las clases de evento
64
+
65
+ `StreamBusEvent` usa `@dataclass(kw_only=True)`. Todas las subclases deben declararse también con `@dataclass(kw_only=True)`.
66
+
67
+ Esto es necesario porque `StreamBusEvent` tiene `occurred_at` con default. Sin `kw_only=True`, Python rechaza subclases que añadan campos requeridos después de un campo con default.
68
+
69
+ ```python
70
+ @dataclass(kw_only=True) # obligatorio
71
+ class ClientEvent(StreamBusEvent):
72
+ client_id: str
73
+ name: str
74
+ ```
75
+ <!-- /rule:kw-only -->
76
+
77
+ <!-- rule:config-naming -->
78
+ ## Nombres de campos en objetos de configuración
79
+
80
+ Los campos dentro de un objeto de configuración tipado no repiten el contexto que ya da el nombre de la clase.
81
+
82
+ Correcto: `RedisConfig.url` — el tipo ya establece que es Redis.
83
+
84
+ Incorrecto: `RedisConfig.redis_url` — repite "redis" innecesariamente.
85
+
86
+ Aplicar esta regla a cualquier objeto de configuración nuevo que se añada a la librería.
87
+ <!-- /rule:config-naming -->
88
+
89
+ <!-- rule:local-event-class -->
90
+ ## Cada consumer define su propia clase de evento
91
+
92
+ Los consumers no comparten la definición de `ClientEvent` con el publisher ni entre sí. Cada uno declara únicamente los campos que necesita. Los campos del stream que no aparezcan en la clase local se descartan automáticamente en `from_dict`.
93
+
94
+ Esto mantiene el acoplamiento al mínimo: un consumer de studio no necesita conocer que curly publica `slug` si no lo usa.
95
+
96
+ ```python
97
+ # studio solo necesita estos tres
98
+ @dataclass(kw_only=True)
99
+ class ClientEvent(StreamBusEvent):
100
+ client_id: str
101
+ name: str
102
+ is_active: str
103
+ ```
104
+ <!-- /rule:local-event-class -->
105
+
106
+ <!-- rule:exceptions -->
107
+ ## Jerarquía de excepciones
108
+
109
+ Usar siempre las excepciones del módulo `streambus.exceptions`:
110
+
111
+ - `StreambusError` — base de todas las excepciones de la librería.
112
+ - `ConfigurationError` — parámetros inválidos o ausentes en construcción de `EventListener` o `EventPublisher`.
113
+ - `EventValidationError` — evento inválido en `publish()` (no es `StreamBusEvent`, `event_type` vacío).
114
+
115
+ No lanzar `ValueError` ni `TypeError` directamente desde código de la librería. Si se añade nueva lógica de validación, subclasificar desde `StreambusError`.
116
+ <!-- /rule:exceptions -->
@@ -0,0 +1 @@
1
+ AGENTS.md
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Jose Meira
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,200 @@
1
+ Metadata-Version: 2.5
2
+ Name: streambus
3
+ Version: 0.1.0
4
+ Summary: Lightweight Redis Streams event listener with a clean callback API
5
+ Project-URL: Homepage, https://github.com/jmeiracorbal/streambus
6
+ Project-URL: Repository, https://github.com/jmeiracorbal/streambus
7
+ Project-URL: Issues, https://github.com/jmeiracorbal/streambus/issues
8
+ Author-email: Jose Meira <jmeiracorbal@gmail.com>
9
+ License: MIT License
10
+
11
+ Copyright (c) 2026 Jose Meira
12
+
13
+ Permission is hereby granted, free of charge, to any person obtaining a copy
14
+ of this software and associated documentation files (the "Software"), to deal
15
+ in the Software without restriction, including without limitation the rights
16
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
17
+ copies of the Software, and to permit persons to whom the Software is
18
+ furnished to do so, subject to the following conditions:
19
+
20
+ The above copyright notice and this permission notice shall be included in all
21
+ copies or substantial portions of the Software.
22
+
23
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
24
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
25
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
26
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
27
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
28
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
29
+ SOFTWARE.
30
+ License-File: LICENSE
31
+ Keywords: consumer,event-bus,events,producer,pubsub,redis,streams
32
+ Classifier: Development Status :: 3 - Alpha
33
+ Classifier: Intended Audience :: Developers
34
+ Classifier: License :: OSI Approved :: MIT License
35
+ Classifier: Programming Language :: Python :: 3
36
+ Classifier: Programming Language :: Python :: 3.11
37
+ Classifier: Programming Language :: Python :: 3.12
38
+ Classifier: Topic :: Software Development :: Libraries
39
+ Classifier: Topic :: System :: Distributed Computing
40
+ Requires-Python: >=3.11
41
+ Requires-Dist: redis>=5.0
42
+ Description-Content-Type: text/markdown
43
+
44
+ # streambus
45
+
46
+ [![PyPI version](https://img.shields.io/pypi/v/streambus?color=e8445a&label=pypi)](https://pypi.org/project/streambus/)
47
+ [![Python](https://img.shields.io/badge/python-3.11%2B-4584b6?logo=python&logoColor=white)](https://www.python.org/)
48
+ [![License](https://img.shields.io/badge/license-MIT-22c55e)](LICENSE)
49
+ [![Tests](https://img.shields.io/badge/tests-18%20passed-22c55e)](#development)
50
+
51
+ Lightweight event bus over Redis Streams. Define typed events, publish from one service, consume in others without boilerplate or framework dependencies.
52
+
53
+ ## Install
54
+
55
+ ```bash
56
+ pip install streambus
57
+ ```
58
+
59
+ ```bash
60
+ uv add streambus
61
+ ```
62
+
63
+ ## Quick start
64
+
65
+ Define an event:
66
+
67
+ ```python
68
+ from dataclasses import dataclass
69
+ from streambus import StreamBusEvent
70
+
71
+ @dataclass(kw_only=True)
72
+ class OrderCreated(StreamBusEvent):
73
+ order_id: str
74
+ customer_id: str
75
+ total: str
76
+ ```
77
+
78
+ Publish it:
79
+
80
+ ```python
81
+ from streambus import EventPublisher, RedisConfig
82
+
83
+ publisher = EventPublisher(
84
+ stream="orders:events",
85
+ config=RedisConfig(url="redis://localhost:6379"),
86
+ )
87
+
88
+ publisher.publish(
89
+ OrderCreated(
90
+ event_type="order.created",
91
+ order_id="ord_123",
92
+ customer_id="cust_456",
93
+ total="99.90",
94
+ )
95
+ )
96
+ ```
97
+
98
+ Consume it:
99
+
100
+ ```python
101
+ from streambus import EventListener, RedisConfig
102
+
103
+ def handle_order(event: OrderCreated) -> None:
104
+ print(f"New order {event.order_id}: total {event.total}")
105
+
106
+ EventListener(
107
+ stream="orders:events",
108
+ group="notifications",
109
+ handler=handle_order,
110
+ event_class=OrderCreated,
111
+ config=RedisConfig(url="redis://localhost:6379"),
112
+ ).run()
113
+ ```
114
+
115
+ ## How it works
116
+
117
+ streambus uses [Redis Streams](https://redis.io/docs/data-types/streams/) for transport: persistent storage, consumer groups, and at-least-once delivery. The library manages group creation, the blocking read loop, message acknowledgement, and automatic reconnection on connection loss.
118
+
119
+ Each consumer group processes events independently. A message published to a stream reaches every group exactly once.
120
+
121
+ ## Events
122
+
123
+ All events extend `StreamBusEvent`:
124
+
125
+ | Field | Type | Required | Notes |
126
+ |---|---|---|---|
127
+ | `event_type` | `str` | yes | Identifies the event. Convention: `noun.verb` |
128
+ | `occurred_at` | `str` | no | ISO 8601 timestamp. Auto-set on creation. |
129
+
130
+ Subclasses declare only the fields they need. Unknown fields arriving from the stream are silently discarded — each consumer maps what it uses, nothing more.
131
+
132
+ Both `StreamBusEvent` and its subclasses must use `@dataclass(kw_only=True)`. This is required: the base class has a field with a default (`occurred_at`), and `kw_only=True` prevents the ordering conflict that would otherwise block subclasses from adding required fields.
133
+
134
+ ## Configuration
135
+
136
+ **RedisConfig**
137
+
138
+ ```python
139
+ RedisConfig(
140
+ url="redis://localhost:6379", # required
141
+ socket_timeout=None, # None = no timeout (correct for blocking reads)
142
+ socket_connect_timeout=5.0, # seconds to wait on initial connect
143
+ )
144
+ ```
145
+
146
+ **EventListener**
147
+
148
+ ```python
149
+ EventListener(
150
+ stream="stream:name", # required
151
+ group="consumer-group", # required
152
+ handler=my_handler, # required — callable(event) -> None
153
+ event_class=MyEvent, # required — must subclass StreamBusEvent
154
+ config=RedisConfig(...), # required
155
+ consumer=None, # defaults to "{group}-1"
156
+ batch_size=10,
157
+ block_ms=5000,
158
+ retry_delay=3.0,
159
+ )
160
+ ```
161
+
162
+ **EventPublisher**
163
+
164
+ ```python
165
+ EventPublisher(
166
+ stream="stream:name", # required
167
+ config=RedisConfig(...), # required
168
+ )
169
+ ```
170
+
171
+ ## Exceptions
172
+
173
+ | Exception | When |
174
+ |---|---|
175
+ | `ConfigurationError` | Invalid or missing parameters at construction time |
176
+ | `EventValidationError` | `publish()` receives a non-`StreamBusEvent` or empty `event_type` |
177
+ | `StreambusError` | Base class for all streambus exceptions |
178
+
179
+ ## Development
180
+
181
+ ```bash
182
+ git clone https://github.com/yourorg/streambus
183
+ cd streambus
184
+ uv sync --group dev
185
+ uv run pytest tests/ -v
186
+ ```
187
+
188
+ Run the example (requires Docker):
189
+
190
+ ```bash
191
+ cd example
192
+ docker compose up -d # start Redis
193
+ uv sync
194
+ uv run python consume.py # terminal 1
195
+ uv run python publish.py # terminal 2
196
+ ```
197
+
198
+ ## License
199
+
200
+ MIT
@@ -0,0 +1,157 @@
1
+ # streambus
2
+
3
+ [![PyPI version](https://img.shields.io/pypi/v/streambus?color=e8445a&label=pypi)](https://pypi.org/project/streambus/)
4
+ [![Python](https://img.shields.io/badge/python-3.11%2B-4584b6?logo=python&logoColor=white)](https://www.python.org/)
5
+ [![License](https://img.shields.io/badge/license-MIT-22c55e)](LICENSE)
6
+ [![Tests](https://img.shields.io/badge/tests-18%20passed-22c55e)](#development)
7
+
8
+ Lightweight event bus over Redis Streams. Define typed events, publish from one service, consume in others without boilerplate or framework dependencies.
9
+
10
+ ## Install
11
+
12
+ ```bash
13
+ pip install streambus
14
+ ```
15
+
16
+ ```bash
17
+ uv add streambus
18
+ ```
19
+
20
+ ## Quick start
21
+
22
+ Define an event:
23
+
24
+ ```python
25
+ from dataclasses import dataclass
26
+ from streambus import StreamBusEvent
27
+
28
+ @dataclass(kw_only=True)
29
+ class OrderCreated(StreamBusEvent):
30
+ order_id: str
31
+ customer_id: str
32
+ total: str
33
+ ```
34
+
35
+ Publish it:
36
+
37
+ ```python
38
+ from streambus import EventPublisher, RedisConfig
39
+
40
+ publisher = EventPublisher(
41
+ stream="orders:events",
42
+ config=RedisConfig(url="redis://localhost:6379"),
43
+ )
44
+
45
+ publisher.publish(
46
+ OrderCreated(
47
+ event_type="order.created",
48
+ order_id="ord_123",
49
+ customer_id="cust_456",
50
+ total="99.90",
51
+ )
52
+ )
53
+ ```
54
+
55
+ Consume it:
56
+
57
+ ```python
58
+ from streambus import EventListener, RedisConfig
59
+
60
+ def handle_order(event: OrderCreated) -> None:
61
+ print(f"New order {event.order_id}: total {event.total}")
62
+
63
+ EventListener(
64
+ stream="orders:events",
65
+ group="notifications",
66
+ handler=handle_order,
67
+ event_class=OrderCreated,
68
+ config=RedisConfig(url="redis://localhost:6379"),
69
+ ).run()
70
+ ```
71
+
72
+ ## How it works
73
+
74
+ streambus uses [Redis Streams](https://redis.io/docs/data-types/streams/) for transport: persistent storage, consumer groups, and at-least-once delivery. The library manages group creation, the blocking read loop, message acknowledgement, and automatic reconnection on connection loss.
75
+
76
+ Each consumer group processes events independently. A message published to a stream reaches every group exactly once.
77
+
78
+ ## Events
79
+
80
+ All events extend `StreamBusEvent`:
81
+
82
+ | Field | Type | Required | Notes |
83
+ |---|---|---|---|
84
+ | `event_type` | `str` | yes | Identifies the event. Convention: `noun.verb` |
85
+ | `occurred_at` | `str` | no | ISO 8601 timestamp. Auto-set on creation. |
86
+
87
+ Subclasses declare only the fields they need. Unknown fields arriving from the stream are silently discarded — each consumer maps what it uses, nothing more.
88
+
89
+ Both `StreamBusEvent` and its subclasses must use `@dataclass(kw_only=True)`. This is required: the base class has a field with a default (`occurred_at`), and `kw_only=True` prevents the ordering conflict that would otherwise block subclasses from adding required fields.
90
+
91
+ ## Configuration
92
+
93
+ **RedisConfig**
94
+
95
+ ```python
96
+ RedisConfig(
97
+ url="redis://localhost:6379", # required
98
+ socket_timeout=None, # None = no timeout (correct for blocking reads)
99
+ socket_connect_timeout=5.0, # seconds to wait on initial connect
100
+ )
101
+ ```
102
+
103
+ **EventListener**
104
+
105
+ ```python
106
+ EventListener(
107
+ stream="stream:name", # required
108
+ group="consumer-group", # required
109
+ handler=my_handler, # required — callable(event) -> None
110
+ event_class=MyEvent, # required — must subclass StreamBusEvent
111
+ config=RedisConfig(...), # required
112
+ consumer=None, # defaults to "{group}-1"
113
+ batch_size=10,
114
+ block_ms=5000,
115
+ retry_delay=3.0,
116
+ )
117
+ ```
118
+
119
+ **EventPublisher**
120
+
121
+ ```python
122
+ EventPublisher(
123
+ stream="stream:name", # required
124
+ config=RedisConfig(...), # required
125
+ )
126
+ ```
127
+
128
+ ## Exceptions
129
+
130
+ | Exception | When |
131
+ |---|---|
132
+ | `ConfigurationError` | Invalid or missing parameters at construction time |
133
+ | `EventValidationError` | `publish()` receives a non-`StreamBusEvent` or empty `event_type` |
134
+ | `StreambusError` | Base class for all streambus exceptions |
135
+
136
+ ## Development
137
+
138
+ ```bash
139
+ git clone https://github.com/yourorg/streambus
140
+ cd streambus
141
+ uv sync --group dev
142
+ uv run pytest tests/ -v
143
+ ```
144
+
145
+ Run the example (requires Docker):
146
+
147
+ ```bash
148
+ cd example
149
+ docker compose up -d # start Redis
150
+ uv sync
151
+ uv run python consume.py # terminal 1
152
+ uv run python publish.py # terminal 2
153
+ ```
154
+
155
+ ## License
156
+
157
+ MIT
@@ -0,0 +1,5 @@
1
+ services:
2
+ redis:
3
+ image: redis:7-alpine
4
+ ports:
5
+ - "6379:6379"
@@ -0,0 +1,38 @@
1
+ """
2
+ Listen for client events and print them.
3
+
4
+ Usage:
5
+ python consume.py
6
+ """
7
+ import logging
8
+ from dataclasses import dataclass
9
+
10
+ from streambus import EventListener, RedisConfig, StreamBusEvent
11
+
12
+ logging.basicConfig(level=logging.INFO, format="%(message)s")
13
+
14
+
15
+ @dataclass
16
+ class ClientEvent(StreamBusEvent):
17
+ client_id: str = ""
18
+ name: str = ""
19
+ slug: str = ""
20
+ is_active: str = ""
21
+
22
+
23
+ def handle(event: ClientEvent) -> None:
24
+ print(f" client_id : {event.client_id}")
25
+ print(f" name : {event.name}")
26
+ print(f" slug : {event.slug}")
27
+ print(f" is_active : {event.is_active}")
28
+ print(f" occurred : {event.occurred_at}")
29
+ print()
30
+
31
+
32
+ EventListener(
33
+ stream="mynps:clients:events",
34
+ group="example",
35
+ handler=handle,
36
+ event_class=ClientEvent,
37
+ config=RedisConfig(url="redis://localhost:6379"),
38
+ ).run()
@@ -0,0 +1,42 @@
1
+ """
2
+ Send test client events to the Redis stream.
3
+
4
+ Usage:
5
+ python publish.py # sends 3 predefined events
6
+ python publish.py "My Client" my-client
7
+ """
8
+ import sys
9
+ import uuid
10
+ from datetime import datetime, timezone
11
+
12
+ import redis
13
+
14
+ STREAM = "mynps:clients:events"
15
+ r = redis.from_url("redis://localhost:6379")
16
+
17
+
18
+ def publish(name: str, slug: str, is_active: bool = True) -> bytes:
19
+ payload = {
20
+ "event_type": "client.updated",
21
+ "client_id": str(uuid.uuid4()),
22
+ "name": name,
23
+ "slug": slug,
24
+ "is_active": str(is_active),
25
+ "occurred_at": datetime.now(timezone.utc).isoformat(),
26
+ }
27
+ return r.xadd(STREAM, payload)
28
+
29
+
30
+ if __name__ == "__main__":
31
+ if len(sys.argv) == 3:
32
+ events = [(sys.argv[1], sys.argv[2])]
33
+ else:
34
+ events = [
35
+ ("Acme Corp", "acme-corp"),
36
+ ("Beta Ltd", "beta-ltd"),
37
+ ("Gamma SA", "gamma-sa"),
38
+ ]
39
+
40
+ for name, slug in events:
41
+ msg_id = publish(name, slug)
42
+ print(f"→ {name} [{msg_id.decode()}]")
@@ -0,0 +1,8 @@
1
+ [project]
2
+ name = "streambus-example"
3
+ version = "0.1.0"
4
+ requires-python = ">=3.11"
5
+ dependencies = ["streambus", "redis>=5.0"]
6
+
7
+ [tool.uv.sources]
8
+ streambus = { path = "..", editable = true }
@@ -0,0 +1,57 @@
1
+ version = 1
2
+ revision = 2
3
+ requires-python = ">=3.11"
4
+
5
+ [[package]]
6
+ name = "async-timeout"
7
+ version = "5.0.1"
8
+ source = { registry = "https://pypi.org/simple" }
9
+ sdist = { url = "https://files.pythonhosted.org/packages/a5/ae/136395dfbfe00dfc94da3f3e136d0b13f394cba8f4841120e34226265780/async_timeout-5.0.1.tar.gz", hash = "sha256:d9321a7a3d5a6a5e187e824d2fa0793ce379a202935782d555d6e9d2735677d3", size = 9274, upload-time = "2024-11-06T16:41:39.6Z" }
10
+ wheels = [
11
+ { url = "https://files.pythonhosted.org/packages/fe/ba/e2081de779ca30d473f21f5b30e0e737c438205440784c7dfc81efc2b029/async_timeout-5.0.1-py3-none-any.whl", hash = "sha256:39e3809566ff85354557ec2398b55e096c8364bacac9405a7a1fa429e77fe76c", size = 6233, upload-time = "2024-11-06T16:41:37.9Z" },
12
+ ]
13
+
14
+ [[package]]
15
+ name = "redis"
16
+ version = "8.1.0"
17
+ source = { registry = "https://pypi.org/simple" }
18
+ dependencies = [
19
+ { name = "async-timeout", marker = "python_full_version < '3.11.3'" },
20
+ ]
21
+ sdist = { url = "https://files.pythonhosted.org/packages/a8/99/604f0b666d4c616d891cf77ebb9db6bb21601344c051aebf1b72b9ff915f/redis-8.1.0.tar.gz", hash = "sha256:6e1a19beef9225c83efd689c7e6b7da2d5215b1f42cd13b7fc3714d0a09c7b25", size = 5254356, upload-time = "2026-07-30T08:51:00.269Z" }
22
+ wheels = [
23
+ { url = "https://files.pythonhosted.org/packages/66/9d/c5731f6e3608663d4d3656fd8d3aecee8b509c3082818f5a13eae925baea/redis-8.1.0-py3-none-any.whl", hash = "sha256:a4fe1aac3d3b3cc791d4b3d5931c5a956045dc951ee74d1c913ee3ac4d2ee9fb", size = 560618, upload-time = "2026-07-30T08:50:58.497Z" },
24
+ ]
25
+
26
+ [[package]]
27
+ name = "streambus"
28
+ version = "0.1.0"
29
+ source = { editable = "../" }
30
+ dependencies = [
31
+ { name = "redis" },
32
+ ]
33
+
34
+ [package.metadata]
35
+ requires-dist = [{ name = "redis", specifier = ">=5.0" }]
36
+
37
+ [package.metadata.requires-dev]
38
+ dev = [
39
+ { name = "fakeredis" },
40
+ { name = "pytest" },
41
+ { name = "pytest-mock" },
42
+ ]
43
+
44
+ [[package]]
45
+ name = "streambus-example"
46
+ version = "0.1.0"
47
+ source = { virtual = "." }
48
+ dependencies = [
49
+ { name = "redis" },
50
+ { name = "streambus" },
51
+ ]
52
+
53
+ [package.metadata]
54
+ requires-dist = [
55
+ { name = "redis", specifier = ">=5.0" },
56
+ { name = "streambus", editable = "../" },
57
+ ]
@@ -0,0 +1,33 @@
1
+ [project]
2
+ name = "streambus"
3
+ version = "0.1.0"
4
+ description = "Lightweight Redis Streams event listener with a clean callback API"
5
+ readme = "README.md"
6
+ requires-python = ">=3.11"
7
+ license = { file = "LICENSE" }
8
+ authors = [{ name = "Jose Meira", email = "jmeiracorbal@gmail.com" }]
9
+ keywords = ["redis", "streams", "event-bus", "events", "pubsub", "consumer", "producer"]
10
+ classifiers = [
11
+ "Development Status :: 3 - Alpha",
12
+ "Intended Audience :: Developers",
13
+ "License :: OSI Approved :: MIT License",
14
+ "Programming Language :: Python :: 3",
15
+ "Programming Language :: Python :: 3.11",
16
+ "Programming Language :: Python :: 3.12",
17
+ "Topic :: Software Development :: Libraries",
18
+ "Topic :: System :: Distributed Computing",
19
+ ]
20
+ dependencies = ["redis>=5.0"]
21
+
22
+ [project.urls]
23
+ Homepage = "https://github.com/jmeiracorbal/streambus"
24
+ Repository = "https://github.com/jmeiracorbal/streambus"
25
+ Issues = "https://github.com/jmeiracorbal/streambus/issues"
26
+
27
+ [dependency-groups]
28
+ dev = ["pytest", "pytest-mock", "fakeredis"]
29
+
30
+ [build-system]
31
+ requires = ["hatchling"]
32
+ build-backend = "hatchling.build"
33
+
@@ -0,0 +1,16 @@
1
+ from .config import RedisConfig
2
+ from .event import StreamBusEvent
3
+ from .exceptions import ConfigurationError, EventValidationError, StreambusError
4
+ from .listener import EventListener
5
+ from .publisher import EventPublisher
6
+
7
+ __all__ = [
8
+ "EventListener",
9
+ "EventPublisher",
10
+ "RedisConfig",
11
+ "StreamBusEvent",
12
+ "StreambusError",
13
+ "ConfigurationError",
14
+ "EventValidationError",
15
+ ]
16
+ __version__ = "0.1.0"
@@ -0,0 +1,8 @@
1
+ from dataclasses import dataclass, field
2
+
3
+
4
+ @dataclass
5
+ class RedisConfig:
6
+ url: str
7
+ socket_timeout: float | None = field(default=None)
8
+ socket_connect_timeout: float | None = field(default=5.0)
@@ -0,0 +1,16 @@
1
+ from dataclasses import dataclass, asdict, field, fields as dc_fields
2
+ from datetime import datetime, timezone
3
+
4
+
5
+ @dataclass(kw_only=True)
6
+ class StreamBusEvent:
7
+ event_type: str
8
+ occurred_at: str = field(default_factory=lambda: datetime.now(timezone.utc).isoformat())
9
+
10
+ def to_dict(self) -> dict[str, str]:
11
+ return {k: str(v) for k, v in asdict(self).items()}
12
+
13
+ @classmethod
14
+ def from_dict(cls, data: dict[str, str]) -> "StreamBusEvent":
15
+ known = {f.name for f in dc_fields(cls)}
16
+ return cls(**{k: v for k, v in data.items() if k in known})
@@ -0,0 +1,10 @@
1
+ class StreambusError(Exception):
2
+ pass
3
+
4
+
5
+ class ConfigurationError(StreambusError):
6
+ pass
7
+
8
+
9
+ class EventValidationError(StreambusError):
10
+ pass
@@ -0,0 +1,94 @@
1
+ import logging
2
+ import time
3
+ from typing import Callable
4
+
5
+ import redis as redis_lib
6
+
7
+ from streambus.config import RedisConfig
8
+ from streambus.event import StreamBusEvent
9
+ from streambus.exceptions import ConfigurationError
10
+
11
+ logger = logging.getLogger(__name__)
12
+
13
+
14
+ class EventListener:
15
+ def __init__(
16
+ self,
17
+ stream: str,
18
+ group: str,
19
+ handler: Callable[[StreamBusEvent], None],
20
+ event_class: type[StreamBusEvent],
21
+ config: RedisConfig,
22
+ consumer: str | None = None,
23
+ batch_size: int = 10,
24
+ block_ms: int = 5000,
25
+ retry_delay: float = 3.0,
26
+ ):
27
+ if not stream:
28
+ raise ConfigurationError("stream is required")
29
+ if not group:
30
+ raise ConfigurationError("group is required")
31
+ if not callable(handler):
32
+ raise ConfigurationError("handler must be callable")
33
+ if not (isinstance(event_class, type) and issubclass(event_class, StreamBusEvent)):
34
+ raise ConfigurationError("event_class must be a subclass of StreamBusEvent")
35
+ if not isinstance(config, RedisConfig):
36
+ raise ConfigurationError("config must be a RedisConfig instance")
37
+ if not config.url:
38
+ raise ConfigurationError("config.url is required")
39
+
40
+ self.stream = stream
41
+ self.group = group
42
+ self.handler = handler
43
+ self.event_class = event_class
44
+ self.config = config
45
+ self.consumer = consumer or f"{group}-1"
46
+ self.batch_size = batch_size
47
+ self.block_ms = block_ms
48
+ self.retry_delay = retry_delay
49
+
50
+ def run(self) -> None:
51
+ r = self._connect()
52
+ self._ensure_group(r)
53
+ logger.info("[%s] listening on %s", self.group, self.stream)
54
+
55
+ while True:
56
+ try:
57
+ results = r.xreadgroup(
58
+ self.group,
59
+ self.consumer,
60
+ {self.stream: ">"},
61
+ count=self.batch_size,
62
+ block=self.block_ms,
63
+ )
64
+ for _stream, messages in (results or []):
65
+ for msg_id, data in messages:
66
+ try:
67
+ event = self.event_class.from_dict(data)
68
+ self.handler(event)
69
+ r.xack(self.stream, self.group, msg_id)
70
+ except Exception:
71
+ logger.exception("error processing message %s", msg_id)
72
+ except redis_lib.exceptions.ConnectionError:
73
+ logger.warning(
74
+ "[%s] redis connection lost, retrying in %.1fs",
75
+ self.group,
76
+ self.retry_delay,
77
+ )
78
+ time.sleep(self.retry_delay)
79
+ r = self._connect()
80
+
81
+ def _connect(self) -> redis_lib.Redis:
82
+ return redis_lib.from_url(
83
+ self.config.url,
84
+ decode_responses=True,
85
+ socket_timeout=self.config.socket_timeout,
86
+ socket_connect_timeout=self.config.socket_connect_timeout,
87
+ )
88
+
89
+ def _ensure_group(self, r: redis_lib.Redis) -> None:
90
+ try:
91
+ r.xgroup_create(self.stream, self.group, id="0", mkstream=True)
92
+ except redis_lib.exceptions.ResponseError as exc:
93
+ if "BUSYGROUP" not in str(exc):
94
+ raise
@@ -0,0 +1,40 @@
1
+ import logging
2
+
3
+ import redis as redis_lib
4
+
5
+ from streambus.config import RedisConfig
6
+ from streambus.event import StreamBusEvent
7
+ from streambus.exceptions import ConfigurationError, EventValidationError
8
+
9
+ logger = logging.getLogger(__name__)
10
+
11
+
12
+ class EventPublisher:
13
+ def __init__(self, stream: str, config: RedisConfig):
14
+ if not stream:
15
+ raise ConfigurationError("stream is required")
16
+ if not isinstance(config, RedisConfig):
17
+ raise ConfigurationError("config must be a RedisConfig instance")
18
+ if not config.url:
19
+ raise ConfigurationError("config.url is required")
20
+
21
+ self.stream = stream
22
+ self.config = config
23
+ self._redis: redis_lib.Redis | None = None
24
+
25
+ def publish(self, event: StreamBusEvent) -> None:
26
+ if not isinstance(event, StreamBusEvent):
27
+ raise EventValidationError("event must be a StreamBusEvent instance")
28
+ if not event.event_type:
29
+ raise EventValidationError("event.event_type is required")
30
+
31
+ self._connect().xadd(self.stream, event.to_dict())
32
+
33
+ def _connect(self) -> redis_lib.Redis:
34
+ if self._redis is None:
35
+ self._redis = redis_lib.from_url(
36
+ self.config.url,
37
+ socket_timeout=self.config.socket_timeout,
38
+ socket_connect_timeout=self.config.socket_connect_timeout,
39
+ )
40
+ return self._redis
File without changes
@@ -0,0 +1,45 @@
1
+ from dataclasses import dataclass
2
+
3
+ import pytest
4
+
5
+ from streambus import StreamBusEvent
6
+
7
+
8
+ @dataclass(kw_only=True)
9
+ class SampleEvent(StreamBusEvent):
10
+ name: str
11
+ value: str
12
+
13
+
14
+ class TestStreamBusEvent:
15
+ def test_to_dict_returns_all_fields_as_strings(self):
16
+ event = SampleEvent(event_type="sample.created", name="Acme", value="42")
17
+ d = event.to_dict()
18
+ assert d["event_type"] == "sample.created"
19
+ assert d["name"] == "Acme"
20
+ assert d["value"] == "42"
21
+ assert all(isinstance(v, str) for v in d.values())
22
+
23
+ def test_to_dict_includes_occurred_at(self):
24
+ event = SampleEvent(event_type="sample.created", name="Acme", value="1")
25
+ d = event.to_dict()
26
+ assert "occurred_at" in d
27
+ assert d["occurred_at"] != ""
28
+
29
+ def test_from_dict_maps_known_fields(self):
30
+ data = {"event_type": "sample.created", "name": "Acme", "value": "42", "occurred_at": "2026-01-01T00:00:00+00:00"}
31
+ event = SampleEvent.from_dict(data)
32
+ assert isinstance(event, SampleEvent)
33
+ assert event.event_type == "sample.created"
34
+ assert event.name == "Acme"
35
+ assert event.value == "42"
36
+
37
+ def test_from_dict_ignores_unknown_fields(self):
38
+ data = {"event_type": "sample.created", "name": "Acme", "value": "1", "unknown": "ignored"}
39
+ event = SampleEvent.from_dict(data)
40
+ assert not hasattr(event, "unknown")
41
+
42
+ def test_from_dict_missing_required_field_raises(self):
43
+ data = {"event_type": "sample.created", "name": "Acme"} # value missing
44
+ with pytest.raises(TypeError):
45
+ SampleEvent.from_dict(data)
@@ -0,0 +1,101 @@
1
+ from dataclasses import dataclass
2
+ from unittest.mock import patch
3
+
4
+ import fakeredis
5
+ import pytest
6
+
7
+ from streambus import EventListener, RedisConfig, StreamBusEvent
8
+ from streambus.exceptions import ConfigurationError
9
+
10
+
11
+ @dataclass(kw_only=True)
12
+ class SampleEvent(StreamBusEvent):
13
+ name: str
14
+
15
+
16
+ @pytest.fixture
17
+ def config():
18
+ return RedisConfig(url="redis://localhost:6379")
19
+
20
+
21
+ @pytest.fixture
22
+ def fake_redis():
23
+ return fakeredis.FakeRedis(decode_responses=True)
24
+
25
+
26
+ class TestEventListenerValidation:
27
+ def test_empty_stream_raises(self, config):
28
+ with pytest.raises(ConfigurationError, match="stream"):
29
+ EventListener(stream="", group="g", handler=lambda e: None, event_class=SampleEvent, config=config)
30
+
31
+ def test_empty_group_raises(self, config):
32
+ with pytest.raises(ConfigurationError, match="group"):
33
+ EventListener(stream="s", group="", handler=lambda e: None, event_class=SampleEvent, config=config)
34
+
35
+ def test_handler_not_callable_raises(self, config):
36
+ with pytest.raises(ConfigurationError, match="handler"):
37
+ EventListener(stream="s", group="g", handler="not_callable", event_class=SampleEvent, config=config)
38
+
39
+ def test_event_class_not_subclass_raises(self, config):
40
+ with pytest.raises(ConfigurationError, match="StreamBusEvent"):
41
+ EventListener(stream="s", group="g", handler=lambda e: None, event_class=dict, config=config)
42
+
43
+ def test_invalid_config_type_raises(self):
44
+ with pytest.raises(ConfigurationError, match="config"):
45
+ EventListener(stream="s", group="g", handler=lambda e: None, event_class=SampleEvent, config="bad")
46
+
47
+ def test_empty_config_url_raises(self):
48
+ with pytest.raises(ConfigurationError, match="config.url"):
49
+ EventListener(stream="s", group="g", handler=lambda e: None, event_class=SampleEvent, config=RedisConfig(url=""))
50
+
51
+
52
+ class TestEventListenerIntegration:
53
+ def test_handler_receives_typed_event(self, config, fake_redis):
54
+ received: list[SampleEvent] = []
55
+
56
+ listener = EventListener(
57
+ stream="test:events",
58
+ group="test",
59
+ handler=received.append,
60
+ event_class=SampleEvent,
61
+ config=config,
62
+ )
63
+
64
+ fake_redis.xadd("test:events", {"event_type": "sample.created", "name": "Acme", "occurred_at": "2026-01-01T00:00:00+00:00"})
65
+
66
+ with patch.object(listener, "_connect", return_value=fake_redis):
67
+ listener._ensure_group(fake_redis)
68
+ results = fake_redis.xreadgroup("test", "test-1", {"test:events": ">"}, count=1, block=0)
69
+ for _stream, messages in (results or []):
70
+ for msg_id, data in messages:
71
+ event = listener.event_class.from_dict(data)
72
+ listener.handler(event)
73
+ fake_redis.xack("test:events", "test", msg_id)
74
+
75
+ assert len(received) == 1
76
+ assert isinstance(received[0], SampleEvent)
77
+ assert received[0].name == "Acme"
78
+
79
+ def test_unknown_stream_fields_are_ignored(self, config, fake_redis):
80
+ received: list[SampleEvent] = []
81
+
82
+ listener = EventListener(
83
+ stream="test:events",
84
+ group="test",
85
+ handler=received.append,
86
+ event_class=SampleEvent,
87
+ config=config,
88
+ )
89
+
90
+ fake_redis.xadd("test:events", {"event_type": "sample.created", "name": "Beta", "occurred_at": "2026-01-01T00:00:00+00:00", "extra_field": "ignored"})
91
+
92
+ with patch.object(listener, "_connect", return_value=fake_redis):
93
+ listener._ensure_group(fake_redis)
94
+ results = fake_redis.xreadgroup("test", "test-1", {"test:events": ">"}, count=1, block=0)
95
+ for _stream, messages in (results or []):
96
+ for msg_id, data in messages:
97
+ event = listener.event_class.from_dict(data)
98
+ listener.handler(event)
99
+
100
+ assert received[0].name == "Beta"
101
+ assert not hasattr(received[0], "extra_field")
@@ -0,0 +1,49 @@
1
+ from dataclasses import dataclass
2
+ from unittest.mock import MagicMock
3
+
4
+ import pytest
5
+
6
+ from streambus import EventPublisher, RedisConfig, StreamBusEvent
7
+ from streambus.exceptions import ConfigurationError, EventValidationError
8
+
9
+
10
+ @dataclass(kw_only=True)
11
+ class SampleEvent(StreamBusEvent):
12
+ name: str
13
+
14
+
15
+ @pytest.fixture
16
+ def config():
17
+ return RedisConfig(url="redis://localhost:6379")
18
+
19
+
20
+ class TestEventPublisherValidation:
21
+ def test_empty_stream_raises(self, config):
22
+ with pytest.raises(ConfigurationError, match="stream"):
23
+ EventPublisher(stream="", config=config)
24
+
25
+ def test_invalid_config_raises(self):
26
+ with pytest.raises(ConfigurationError, match="config"):
27
+ EventPublisher(stream="s", config="bad")
28
+
29
+ def test_non_event_raises_on_publish(self, config):
30
+ publisher = EventPublisher(stream="test:events", config=config)
31
+ with pytest.raises(EventValidationError, match="StreamBusEvent"):
32
+ publisher.publish({"event_type": "bad"}) # type: ignore
33
+
34
+ def test_missing_event_type_raises_on_publish(self, config):
35
+ publisher = EventPublisher(stream="test:events", config=config)
36
+ with pytest.raises(EventValidationError, match="event_type"):
37
+ publisher.publish(SampleEvent(event_type="", name="Acme"))
38
+
39
+
40
+ class TestEventPublisherIntegration:
41
+ def test_publish_calls_xadd(self, config):
42
+ mock_redis = MagicMock()
43
+ publisher = EventPublisher(stream="test:events", config=config)
44
+ publisher._redis = mock_redis
45
+
46
+ event = SampleEvent(event_type="sample.created", name="Acme")
47
+ publisher.publish(event)
48
+
49
+ mock_redis.xadd.assert_called_once_with("test:events", event.to_dict())
@@ -0,0 +1,144 @@
1
+ version = 1
2
+ revision = 2
3
+ requires-python = ">=3.11"
4
+
5
+ [[package]]
6
+ name = "async-timeout"
7
+ version = "5.0.1"
8
+ source = { registry = "https://pypi.org/simple" }
9
+ sdist = { url = "https://files.pythonhosted.org/packages/a5/ae/136395dfbfe00dfc94da3f3e136d0b13f394cba8f4841120e34226265780/async_timeout-5.0.1.tar.gz", hash = "sha256:d9321a7a3d5a6a5e187e824d2fa0793ce379a202935782d555d6e9d2735677d3", size = 9274, upload-time = "2024-11-06T16:41:39.6Z" }
10
+ wheels = [
11
+ { url = "https://files.pythonhosted.org/packages/fe/ba/e2081de779ca30d473f21f5b30e0e737c438205440784c7dfc81efc2b029/async_timeout-5.0.1-py3-none-any.whl", hash = "sha256:39e3809566ff85354557ec2398b55e096c8364bacac9405a7a1fa429e77fe76c", size = 6233, upload-time = "2024-11-06T16:41:37.9Z" },
12
+ ]
13
+
14
+ [[package]]
15
+ name = "colorama"
16
+ version = "0.4.6"
17
+ source = { registry = "https://pypi.org/simple" }
18
+ sdist = { url = "https://files.pythonhosted.org/packages/d8/53/6f443c9a4a8358a93a6792e2acffb9d9d5cb0a5cfd8802644b7b1c9a02e4/colorama-0.4.6.tar.gz", hash = "sha256:08695f5cb7ed6e0531a20572697297273c47b8cae5a63ffc6d6ed5c201be6e44", size = 27697, upload-time = "2022-10-25T02:36:22.414Z" }
19
+ wheels = [
20
+ { url = "https://files.pythonhosted.org/packages/d1/d6/3965ed04c63042e047cb6a3e6ed1a63a35087b6a609aa3a15ed8ac56c221/colorama-0.4.6-py2.py3-none-any.whl", hash = "sha256:4f1d9991f5acc0ca119f9d443620b77f9d6b33703e51011c16baf57afb285fc6", size = 25335, upload-time = "2022-10-25T02:36:20.889Z" },
21
+ ]
22
+
23
+ [[package]]
24
+ name = "fakeredis"
25
+ version = "2.37.1"
26
+ source = { registry = "https://pypi.org/simple" }
27
+ dependencies = [
28
+ { name = "redis" },
29
+ { name = "sortedcontainers" },
30
+ ]
31
+ sdist = { url = "https://files.pythonhosted.org/packages/95/5e/fce3355d20d37dc18f7f4c422653ac69cabffa019afaaf607e26704fb829/fakeredis-2.37.1.tar.gz", hash = "sha256:9045851b0a9fe56312696aadc82435141aa43a193cab462d372c8fb583a7c087", size = 238182, upload-time = "2026-08-18T15:22:01.676Z" }
32
+ wheels = [
33
+ { url = "https://files.pythonhosted.org/packages/7b/e0/fe1c760abd9e9cb5dfbce057b6582cb1ac36dfd8b5ce202e1445605c922d/fakeredis-2.37.1-py3-none-any.whl", hash = "sha256:f15c41be151c1e9206416dece764369a4dedb6b1341df3734c3c2c000e405508", size = 152738, upload-time = "2026-08-18T15:22:00.1Z" },
34
+ ]
35
+
36
+ [[package]]
37
+ name = "iniconfig"
38
+ version = "2.3.0"
39
+ source = { registry = "https://pypi.org/simple" }
40
+ sdist = { url = "https://files.pythonhosted.org/packages/72/34/14ca021ce8e5dfedc35312d08ba8bf51fdd999c576889fc2c24cb97f4f10/iniconfig-2.3.0.tar.gz", hash = "sha256:c76315c77db068650d49c5b56314774a7804df16fee4402c1f19d6d15d8c4730", size = 20503, upload-time = "2025-10-18T21:55:43.219Z" }
41
+ wheels = [
42
+ { url = "https://files.pythonhosted.org/packages/cb/b1/3846dd7f199d53cb17f49cba7e651e9ce294d8497c8c150530ed11865bb8/iniconfig-2.3.0-py3-none-any.whl", hash = "sha256:f631c04d2c48c52b84d0d0549c99ff3859c98df65b3101406327ecc7d53fbf12", size = 7484, upload-time = "2025-10-18T21:55:41.639Z" },
43
+ ]
44
+
45
+ [[package]]
46
+ name = "packaging"
47
+ version = "26.3"
48
+ source = { registry = "https://pypi.org/simple" }
49
+ sdist = { url = "https://files.pythonhosted.org/packages/7d/fa/3944b40b07da9ce895c0e6303a5ab7d53da063554f534556b134a54d6093/packaging-26.3.tar.gz", hash = "sha256:94edc256424af38762eb31306eed28beb9f0efc50a8837492c9d6fd6004aed79", size = 313412, upload-time = "2026-08-04T18:15:28.737Z" }
50
+ wheels = [
51
+ { url = "https://files.pythonhosted.org/packages/63/34/ba1c580383c9eada3711951fef0795c80b829a078d72188184bcab9dd527/packaging-26.3-py3-none-any.whl", hash = "sha256:d7193f7c8e4e93f444fde0262bf90af30e16fa0ad0ad44cb553c87339b23cd1c", size = 129956, upload-time = "2026-08-04T18:15:27.159Z" },
52
+ ]
53
+
54
+ [[package]]
55
+ name = "pluggy"
56
+ version = "1.6.0"
57
+ source = { registry = "https://pypi.org/simple" }
58
+ sdist = { url = "https://files.pythonhosted.org/packages/f9/e2/3e91f31a7d2b083fe6ef3fa267035b518369d9511ffab804f839851d2779/pluggy-1.6.0.tar.gz", hash = "sha256:7dcc130b76258d33b90f61b658791dede3486c3e6bfb003ee5c9bfb396dd22f3", size = 69412, upload-time = "2025-05-15T12:30:07.975Z" }
59
+ wheels = [
60
+ { url = "https://files.pythonhosted.org/packages/54/20/4d324d65cc6d9205fabedc306948156824eb9f0ee1633355a8f7ec5c66bf/pluggy-1.6.0-py3-none-any.whl", hash = "sha256:e920276dd6813095e9377c0bc5566d94c932c33b27a3e3945d8389c374dd4746", size = 20538, upload-time = "2025-05-15T12:30:06.134Z" },
61
+ ]
62
+
63
+ [[package]]
64
+ name = "pygments"
65
+ version = "2.21.0"
66
+ source = { registry = "https://pypi.org/simple" }
67
+ sdist = { url = "https://files.pythonhosted.org/packages/49/2e/ced460408999b33da6b31b0021b0f37d329e202d4169aeb164493778f25b/pygments-2.21.0.tar.gz", hash = "sha256:610ca751c9bc2492b38eb9a38a7fbc93edbbb2d7182edaf34e66ae493dee5c8c", size = 5005329, upload-time = "2026-08-17T08:02:48.824Z" }
68
+ wheels = [
69
+ { url = "https://files.pythonhosted.org/packages/71/46/17f022dd3e953bf20a04a028a21ec746d942f8d2af30fa0f124fa0e6a684/pygments-2.21.0-py3-none-any.whl", hash = "sha256:2363c69b61c4a97c838da3b130dcd6468f4848992b21a82f2a63ec34377137d9", size = 1250147, upload-time = "2026-08-17T08:02:44.912Z" },
70
+ ]
71
+
72
+ [[package]]
73
+ name = "pytest"
74
+ version = "9.1.1"
75
+ source = { registry = "https://pypi.org/simple" }
76
+ dependencies = [
77
+ { name = "colorama", marker = "sys_platform == 'win32'" },
78
+ { name = "iniconfig" },
79
+ { name = "packaging" },
80
+ { name = "pluggy" },
81
+ { name = "pygments" },
82
+ ]
83
+ sdist = { url = "https://files.pythonhosted.org/packages/e4/47/b9efed96c114afcfa3c9d3fe98a76a1d14c74a9e266d397cf6eb64be5e01/pytest-9.1.1.tar.gz", hash = "sha256:1088fbde8f2b49d95a549a195707afa7a76a3ce9bcadc26b6d71f0ffda5fe313", size = 1636369, upload-time = "2026-06-19T10:58:32.857Z" }
84
+ wheels = [
85
+ { url = "https://files.pythonhosted.org/packages/24/25/1de2678b631f5a49215c6c96fff41ba892b0a34df68d6d80292b1b48aa7f/pytest-9.1.1-py3-none-any.whl", hash = "sha256:37a86b45efb9a47a61a36449063e8e18d0cab3161329fc099eb21783169c4f0c", size = 386536, upload-time = "2026-06-19T10:58:31.347Z" },
86
+ ]
87
+
88
+ [[package]]
89
+ name = "pytest-mock"
90
+ version = "3.15.1"
91
+ source = { registry = "https://pypi.org/simple" }
92
+ dependencies = [
93
+ { name = "pytest" },
94
+ ]
95
+ sdist = { url = "https://files.pythonhosted.org/packages/68/14/eb014d26be205d38ad5ad20d9a80f7d201472e08167f0bb4361e251084a9/pytest_mock-3.15.1.tar.gz", hash = "sha256:1849a238f6f396da19762269de72cb1814ab44416fa73a8686deac10b0d87a0f", size = 34036, upload-time = "2025-09-16T16:37:27.081Z" }
96
+ wheels = [
97
+ { url = "https://files.pythonhosted.org/packages/5a/cc/06253936f4a7fa2e0f48dfe6d851d9c56df896a9ab09ac019d70b760619c/pytest_mock-3.15.1-py3-none-any.whl", hash = "sha256:0a25e2eb88fe5168d535041d09a4529a188176ae608a6d249ee65abc0949630d", size = 10095, upload-time = "2025-09-16T16:37:25.734Z" },
98
+ ]
99
+
100
+ [[package]]
101
+ name = "redis"
102
+ version = "8.1.0"
103
+ source = { registry = "https://pypi.org/simple" }
104
+ dependencies = [
105
+ { name = "async-timeout", marker = "python_full_version < '3.11.3'" },
106
+ ]
107
+ sdist = { url = "https://files.pythonhosted.org/packages/a8/99/604f0b666d4c616d891cf77ebb9db6bb21601344c051aebf1b72b9ff915f/redis-8.1.0.tar.gz", hash = "sha256:6e1a19beef9225c83efd689c7e6b7da2d5215b1f42cd13b7fc3714d0a09c7b25", size = 5254356, upload-time = "2026-07-30T08:51:00.269Z" }
108
+ wheels = [
109
+ { url = "https://files.pythonhosted.org/packages/66/9d/c5731f6e3608663d4d3656fd8d3aecee8b509c3082818f5a13eae925baea/redis-8.1.0-py3-none-any.whl", hash = "sha256:a4fe1aac3d3b3cc791d4b3d5931c5a956045dc951ee74d1c913ee3ac4d2ee9fb", size = 560618, upload-time = "2026-07-30T08:50:58.497Z" },
110
+ ]
111
+
112
+ [[package]]
113
+ name = "sortedcontainers"
114
+ version = "2.4.0"
115
+ source = { registry = "https://pypi.org/simple" }
116
+ sdist = { url = "https://files.pythonhosted.org/packages/e8/c4/ba2f8066cceb6f23394729afe52f3bf7adec04bf9ed2c820b39e19299111/sortedcontainers-2.4.0.tar.gz", hash = "sha256:25caa5a06cc30b6b83d11423433f65d1f9d76c4c6a0c90e3379eaa43b9bfdb88", size = 30594, upload-time = "2021-05-16T22:03:42.897Z" }
117
+ wheels = [
118
+ { url = "https://files.pythonhosted.org/packages/32/46/9cb0e58b2deb7f82b84065f37f3bffeb12413f947f9388e4cac22c4621ce/sortedcontainers-2.4.0-py2.py3-none-any.whl", hash = "sha256:a163dcaede0f1c021485e957a39245190e74249897e2ae4b2aa38595db237ee0", size = 29575, upload-time = "2021-05-16T22:03:41.177Z" },
119
+ ]
120
+
121
+ [[package]]
122
+ name = "streambus"
123
+ version = "0.1.0"
124
+ source = { editable = "." }
125
+ dependencies = [
126
+ { name = "redis" },
127
+ ]
128
+
129
+ [package.dev-dependencies]
130
+ dev = [
131
+ { name = "fakeredis" },
132
+ { name = "pytest" },
133
+ { name = "pytest-mock" },
134
+ ]
135
+
136
+ [package.metadata]
137
+ requires-dist = [{ name = "redis", specifier = ">=5.0" }]
138
+
139
+ [package.metadata.requires-dev]
140
+ dev = [
141
+ { name = "fakeredis" },
142
+ { name = "pytest" },
143
+ { name = "pytest-mock" },
144
+ ]