DefStream-Redis 0.1.1__py3-none-any.whl

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,46 @@
1
+ from collections.abc import Mapping
2
+ from dataclasses import dataclass
3
+ from typing import Any
4
+
5
+ __all__ = (
6
+ 'Subscription',
7
+ )
8
+
9
+
10
+ @dataclass(frozen=True)
11
+ class Subscription:
12
+ queue: str
13
+ group: str = 'DefStream'
14
+
15
+ def __post_init__(self) -> None:
16
+ for value in (
17
+ self.queue,
18
+ self.group,
19
+ ):
20
+ if not isinstance(
21
+ value,
22
+ str,
23
+ ) or not value:
24
+ raise ValueError('Redis queue and group must be non-empty strings')
25
+
26
+ @classmethod
27
+ def parse(
28
+ cls,
29
+ parameters: Any,
30
+ ) -> 'Subscription':
31
+ if isinstance(
32
+ parameters,
33
+ cls,
34
+ ):
35
+ return parameters
36
+ if isinstance(
37
+ parameters,
38
+ str,
39
+ ):
40
+ return cls(parameters)
41
+ if isinstance(
42
+ parameters,
43
+ Mapping,
44
+ ):
45
+ return cls(**dict(parameters))
46
+ raise TypeError('Redis subscriptions require a queue name, Subscription or mapping')
@@ -0,0 +1,29 @@
1
+ from ...Event import EventHandler
2
+ from ...Policies import (
3
+ Reject,
4
+ Requeue,
5
+ )
6
+ from .Configuration import (
7
+ Configuration,
8
+ ConnectionType,
9
+ )
10
+ from .Connection import (
11
+ Connection,
12
+ )
13
+ from .Consumer import Consumer
14
+ from .Event import Event
15
+ from .Queue import Queue
16
+ from .Subscription import Subscription
17
+
18
+ __all__ = (
19
+ 'Connection',
20
+ 'Configuration',
21
+ 'ConnectionType',
22
+ 'Consumer',
23
+ 'Event',
24
+ 'EventHandler',
25
+ 'Queue',
26
+ 'Subscription',
27
+ 'Reject',
28
+ 'Requeue',
29
+ )
@@ -0,0 +1,143 @@
1
+ Metadata-Version: 2.4
2
+ Name: DefStream-Redis
3
+ Version: 0.1.1
4
+ Summary: Redis Streams broker adapter for DefStream
5
+ Home-page: https://github.com/yong5eon/DefStream-Redis
6
+ Author: Heo Yongseon
7
+ Project-URL: Source, https://github.com/yong5eon/DefStream-Redis
8
+ Project-URL: Issues, https://github.com/yong5eon/DefStream-Redis/issues
9
+ Classifier: Programming Language :: Python :: 3.9
10
+ Classifier: Programming Language :: Python :: 3.10
11
+ Classifier: Programming Language :: Python :: 3.11
12
+ Classifier: Programming Language :: Python :: 3.12
13
+ Classifier: Programming Language :: Python :: 3.13
14
+ Classifier: Programming Language :: Python :: 3.14
15
+ Requires-Python: >=3.9
16
+ Description-Content-Type: text/markdown
17
+ License-File: LICENSE
18
+ Requires-Dist: DefStream>=0.1.0
19
+ Requires-Dist: redis>=5.1.1
20
+ Dynamic: author
21
+ Dynamic: classifier
22
+ Dynamic: description
23
+ Dynamic: description-content-type
24
+ Dynamic: home-page
25
+ Dynamic: license-file
26
+ Dynamic: project-url
27
+ Dynamic: requires-dist
28
+ Dynamic: requires-python
29
+ Dynamic: summary
30
+
31
+ # DefStream-Redis
32
+
33
+ ## CI and PyPI releases
34
+
35
+ The `CI` workflow tests PRs targeting `master` and pushes to `master` on Python
36
+ 3.9 through 3.14. It builds all three DefStream packages from source, installs
37
+ their wheels in a clean environment, and runs this repository's tests with
38
+ RabbitMQ 4.1 and Redis 7.4 service containers. The current repository uses the
39
+ event commit; sibling repositories use their `master` branches, with resolved
40
+ commit IDs recorded in the log. All three GitHub repositories must be accessible.
41
+ This bootstrap setup does not require existing PyPI releases and does not
42
+ certify compatibility with previously published dependencies.
43
+
44
+ On a `master` push, the build uses `major.minor.<github.run_number>` from the
45
+ checked-in `VERSION` (for example, `0.1.42`). PR builds retain `VERSION`. No
46
+ version commit, PR, or tag is created. Change major/minor to start a new series;
47
+ run numbers can have gaps. Check for PyPI version collisions before replacing
48
+ or renaming the workflow.
49
+
50
+ Only after all six Python checks pass does a separate publish job upload the
51
+ exact Python 3.13 build artifacts. A fully published version is skipped on a
52
+ rerun; first-attempt collisions, incomplete releases, and unexpected network
53
+ errors fail. Active runs are not cancelled; older pending runs may be superseded.
54
+
55
+ Configure `PYPI_API_TOKEN` as a repository Actions secret or a secret in the
56
+ `pypi` environment. Restrict that environment to `master`; omit approval rules
57
+ for fully automatic releases. Protect `master` with required PRs and all six
58
+ `Test Python 3.x` checks, not the push-only `Publish PyPI` job. Never commit the
59
+ token. Publish the core before this adapter so users can resolve its dependency.
60
+
61
+ Redis Streams broker adapter for DefStream, distributed separately from the
62
+ core. Requires Python 3.9 or newer and Redis 6.2 or newer.
63
+
64
+ ## Installation
65
+
66
+ ```shell
67
+ pip install DefStream-Redis
68
+ ```
69
+
70
+ This installs `DefStream>=0.1.0` and `redis>=5.1.1`. The distribution name is
71
+ `DefStream-Redis`; the Python import path remains
72
+ `DefStream.Broker.Implements.Redis`.
73
+
74
+ ## Usage
75
+
76
+ ```python
77
+ from DefStream.Broker.Implements.Redis import (
78
+ Configuration,
79
+ Connection,
80
+ )
81
+
82
+ broker = Connection(Configuration(
83
+ host='127.0.0.1',
84
+ port=6379,
85
+ ))
86
+ broker.connect()
87
+ try:
88
+ broker.create_queue('tasks')
89
+ broker.queue('tasks').send({'message': 'hello'})
90
+ finally:
91
+ broker.close()
92
+ ```
93
+
94
+ A reachable Redis server is required. The adapter uses Redis Streams, not
95
+ Pub/Sub or lists. It provides stream-backed queues, consumer groups,
96
+ subscriptions, and error policies. Use its `Connection` with
97
+ `DefStream.Worker.Worker` for worker execution.
98
+
99
+ `ConnectionType.Pool` is the default; `ConnectionType.Cluster` uses Redis
100
+ Cluster and requires database 0. Exchanges and RPC are not supported.
101
+
102
+ ## Source layout
103
+
104
+ The contents of the former `DefStream/src/Broker/Implements/Redis` directory
105
+ now live directly in this project's [src](./src) directory. Packaging maps that
106
+ directory to `DefStream.Broker.Implements.Redis`; this distribution does not
107
+ own or overwrite the parent packages supplied by DefStream.
108
+
109
+ ## Development
110
+
111
+ With the core and both adapters checked out as sibling directories, run this
112
+ from their common parent using your virtual environment's Python:
113
+
114
+ ```powershell
115
+ python -m pip install --config-settings editable_mode=strict -e .\DefStream
116
+ python -m pip install -e .\DefStream-RabbitMQ -e .\DefStream-Redis
117
+ python -m unittest discover -s .\DefStream-Redis\test -p "test_*.py"
118
+ ```
119
+
120
+ The core uses strict editable mode to prevent the adapters' editable namespace
121
+ entries from masking its packages. Keep the core's generated `build` link tree;
122
+ reinstall the core after adding or removing its modules. Adapters use default
123
+ editable mode.
124
+
125
+ Redis-specific tests live in this project's `test` directory, covering
126
+ connections, queues, consumers, serialization, and broker integration.
127
+ Broker examples live in `sample`. Shared Worker, Inspector, and cross-adapter
128
+ contract tests remain in the DefStream repository and require both adapters.
129
+
130
+ Run `python -m unittest discover -s test -p "test_*.py"` from this project
131
+ directory after installation. Integration tests are opt-in via
132
+ `DEFSTREAM_REDIS_TESTS=1`; ordinary unit tests do not require a running broker
133
+ or the RabbitMQ adapter. The integration suite exercises standalone Redis,
134
+ not Redis Cluster.
135
+
136
+ Do not combine editable installs with a `site-packages/DefStream` link pointing
137
+ directly at the core source: installing adapter files through that link can
138
+ write into the core checkout. Remove such a link before installing the projects.
139
+ Reinstall after changing package metadata or dependencies.
140
+
141
+ ## License
142
+
143
+ See [LICENSE](./LICENSE), copied unchanged from DefStream.
@@ -0,0 +1,13 @@
1
+ DefStream/Broker/Implements/Redis/Configuration.py,sha256=nMO47nCysCJCX_tosJJj5FT9nisrugss3pVIkeqqbtc,1551
2
+ DefStream/Broker/Implements/Redis/Connection.py,sha256=VIbhn_Bwqqt4kvwj8TyG1YugtGqjfxRepQK0A2O2uWA,3064
3
+ DefStream/Broker/Implements/Redis/Consumer.py,sha256=dAhVqS7hPvUEWWnyTqd0vx_r6prQZYXtKsBGC2QTsNY,4686
4
+ DefStream/Broker/Implements/Redis/Event.py,sha256=nz2pKi8ZCgESZ2EEHKU0GHeiq6bTBRjIcRhnwQblMlY,1767
5
+ DefStream/Broker/Implements/Redis/Queue.py,sha256=jIIvN1jqgclslP_rIaB_kP-HkkvqQKLJyd_tYN10lNE,2855
6
+ DefStream/Broker/Implements/Redis/Serializer.py,sha256=NWGxpnf5kegR9i_kr8cxQk5JiXO1lMdvTo2sPmghHe0,635
7
+ DefStream/Broker/Implements/Redis/Subscription.py,sha256=I6MZdT8-VSBeiGBHuOmld11xwiQv048YQLfRGS9FzSE,811
8
+ DefStream/Broker/Implements/Redis/__init__.py,sha256=NgZiKn3c6r4kSovlFnhUU4My-MN5-uepU2qHAnTd5r8,463
9
+ defstream_redis-0.1.1.dist-info/licenses/LICENSE,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
10
+ defstream_redis-0.1.1.dist-info/METADATA,sha256=E6pNFlg1irFcqOfGQWLKwRRc0SGs0yfLDEzhLOCo7wk,5693
11
+ defstream_redis-0.1.1.dist-info/WHEEL,sha256=YVMoNqKzERt-wjUZwJ33xBGAwnFl-4cqbYkTtWa4itE,91
12
+ defstream_redis-0.1.1.dist-info/top_level.txt,sha256=zsnisIu5wHL4b7VM8e9AggG9KTSdUU4morFqpb8YWFs,10
13
+ defstream_redis-0.1.1.dist-info/RECORD,,
@@ -0,0 +1,5 @@
1
+ Wheel-Version: 1.0
2
+ Generator: setuptools (84.0.0)
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
5
+