redqueue 0.10.1__tar.gz → 0.11.1__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.
Files changed (56) hide show
  1. {redqueue-0.10.1 → redqueue-0.11.1}/CHANGELOG.md +155 -101
  2. redqueue-0.11.1/CODE_OF_CONDUCT.md +40 -0
  3. redqueue-0.11.1/CONTRIBUTING.md +87 -0
  4. {redqueue-0.10.1 → redqueue-0.11.1}/PKG-INFO +146 -125
  5. redqueue-0.11.1/README-zh-CN.md +303 -0
  6. redqueue-0.11.1/README.md +313 -0
  7. {redqueue-0.10.1 → redqueue-0.11.1}/docs/API.md +312 -249
  8. {redqueue-0.10.1 → redqueue-0.11.1}/docs/RELEASE.md +151 -131
  9. {redqueue-0.10.1 → redqueue-0.11.1}/pyproject.toml +75 -72
  10. {redqueue-0.10.1 → redqueue-0.11.1}/src/redqueue/__init__.py +75 -72
  11. {redqueue-0.10.1 → redqueue-0.11.1}/src/redqueue/_version.py +6 -6
  12. {redqueue-0.10.1 → redqueue-0.11.1}/src/redqueue/async_client.py +406 -346
  13. {redqueue-0.10.1 → redqueue-0.11.1}/src/redqueue/client.py +384 -328
  14. redqueue-0.11.1/src/redqueue/connection.py +132 -0
  15. redqueue-0.11.1/tests/README.md +58 -0
  16. redqueue-0.11.1/tests/test_availability.py +253 -0
  17. redqueue-0.11.1/tests/test_performance.py +127 -0
  18. {redqueue-0.10.1 → redqueue-0.11.1}/tests/test_project_skeleton.py +601 -329
  19. redqueue-0.11.1/tests/test_real_redis_availability.py +123 -0
  20. redqueue-0.11.1/tests/test_real_redis_performance.py +166 -0
  21. redqueue-0.10.1/README.md +0 -292
  22. redqueue-0.10.1/tests/README.md +0 -22
  23. {redqueue-0.10.1 → redqueue-0.11.1}/.github/workflows/ci.yml +0 -0
  24. {redqueue-0.10.1 → redqueue-0.11.1}/.gitignore +0 -0
  25. {redqueue-0.10.1 → redqueue-0.11.1}/LICENSE +0 -0
  26. {redqueue-0.10.1 → redqueue-0.11.1}/NOTICE +0 -0
  27. {redqueue-0.10.1 → redqueue-0.11.1}/examples/README.md +0 -0
  28. {redqueue-0.10.1 → redqueue-0.11.1}/examples/__init__.py +0 -0
  29. {redqueue-0.10.1 → redqueue-0.11.1}/examples/async_list_queue.py +0 -0
  30. {redqueue-0.10.1 → redqueue-0.11.1}/examples/common.py +0 -0
  31. {redqueue-0.10.1 → redqueue-0.11.1}/examples/compatibility_check.py +0 -0
  32. {redqueue-0.10.1 → redqueue-0.11.1}/examples/custom_serializer.py +0 -0
  33. {redqueue-0.10.1 → redqueue-0.11.1}/examples/delayed_tasks.py +0 -0
  34. {redqueue-0.10.1 → redqueue-0.11.1}/examples/monitoring_hooks.py +0 -0
  35. {redqueue-0.10.1 → redqueue-0.11.1}/examples/stream_queue.py +0 -0
  36. {redqueue-0.10.1 → redqueue-0.11.1}/examples/sync_list_queue.py +0 -0
  37. {redqueue-0.10.1 → redqueue-0.11.1}/requirements.txt +0 -0
  38. {redqueue-0.10.1 → redqueue-0.11.1}/scripts/check.py +0 -0
  39. {redqueue-0.10.1 → redqueue-0.11.1}/src/redqueue/backends/__init__.py +0 -0
  40. {redqueue-0.10.1 → redqueue-0.11.1}/src/redqueue/backends/async_delay.py +0 -0
  41. {redqueue-0.10.1 → redqueue-0.11.1}/src/redqueue/backends/async_list.py +0 -0
  42. {redqueue-0.10.1 → redqueue-0.11.1}/src/redqueue/backends/async_stream.py +0 -0
  43. {redqueue-0.10.1 → redqueue-0.11.1}/src/redqueue/backends/base.py +0 -0
  44. {redqueue-0.10.1 → redqueue-0.11.1}/src/redqueue/backends/delay.py +0 -0
  45. {redqueue-0.10.1 → redqueue-0.11.1}/src/redqueue/backends/list.py +0 -0
  46. {redqueue-0.10.1 → redqueue-0.11.1}/src/redqueue/backends/stream.py +0 -0
  47. {redqueue-0.10.1 → redqueue-0.11.1}/src/redqueue/compat.py +0 -0
  48. {redqueue-0.10.1 → redqueue-0.11.1}/src/redqueue/config.py +0 -0
  49. {redqueue-0.10.1 → redqueue-0.11.1}/src/redqueue/exceptions.py +0 -0
  50. {redqueue-0.10.1 → redqueue-0.11.1}/src/redqueue/message.py +0 -0
  51. {redqueue-0.10.1 → redqueue-0.11.1}/src/redqueue/monitoring.py +0 -0
  52. {redqueue-0.10.1 → redqueue-0.11.1}/src/redqueue/serialization.py +0 -0
  53. {redqueue-0.10.1 → redqueue-0.11.1}/tests/__init__.py +0 -0
  54. {redqueue-0.10.1 → redqueue-0.11.1}/tests/fakes.py +0 -0
  55. {redqueue-0.10.1 → redqueue-0.11.1}/tests/test_backend_contracts.py +0 -0
  56. {redqueue-0.10.1 → redqueue-0.11.1}/tests/test_integration_redis.py +0 -0
@@ -1,110 +1,164 @@
1
- # Changelog / 版本变更记录
2
-
3
- All notable public release changes are documented here.
4
-
5
- 所有公开发布版本的重要变更都会记录在此文件中。
6
-
1
+ # Changelog / 版本变更记录
2
+
3
+ All notable public release changes are documented here.
4
+
5
+ 所有公开发布版本的重要变更都会记录在此文件中。
6
+
7
7
  Development versions are tracked separately from formal release versions.
8
8
  开发版本与正式版本分开管理。
9
9
 
10
- ## [0.10.1] - 2026-06-20
10
+ ## [0.11.1] - 2026-06-21
11
11
 
12
12
  ### Fixed
13
13
 
14
- - Fixed Redis List `ack`, `nack`, `retry`, and dead-letter requeue when custom
15
- serializers do not produce deterministic bytes.
16
- - Fixed delayed task scheduling cleanup so payload keys are removed if `ZADD`
17
- fails after `SET`.
18
- - Fixed Streams dead-letter reads and moves by ensuring the consumer group also
19
- exists on the dead-letter stream.
20
- - Fixed async client creation monitoring so `AsyncQueueClient` emits the same
21
- `client.created` event as the synchronous client.
22
- - Removed duplicate delay scheduling monitoring events from the synchronous
23
- client facade.
24
- - Normalized internal Redis Streams entry ids returned as bytes.
14
+ - Fixed resource cleanup in sync and async `from_url()` when Redis capability
15
+ detection, configuration validation, or backend initialization fails after the
16
+ client created an owned Redis connection.
17
+ - Added explicit `owns_redis` override support to sync and async `from_url()`
18
+ for advanced ownership control.
25
19
 
26
20
  ### 修复
27
21
 
28
- - 修复自定义序列化器输出字节不稳定时,Redis List `ack`、`nack`、`retry`
29
- 和死信重放无法精确删除原始消息的问题。
30
- - 修复延迟任务在 `SET` 成功但 `ZADD` 失败时残留 payload key 的问题。
31
- - 修复 Streams 死信读取和搬移前未确保死信 stream 消费组存在的问题。
32
- - 修复异步客户端创建时未与同步客户端一致发出 `client.created` 监控事件的问题。
33
- - 移除同步客户端门面层重复发出的延迟调度监控事件。
34
- - 统一规范化 Redis Streams 返回的 bytes 类型 entry id。
35
-
36
- ### Validation
37
-
38
- - `python -m ruff check .`
39
- - `PYTHONPATH=src python -m mypy`
40
- - `PYTHONPATH=src python -m pytest`
41
- - `REDQUEUE_REDIS_URL=redis://127.0.0.1:6379/0 PYTHONPATH=src python -m pytest -m integration`
42
-
43
- ### 验证
44
-
45
- - `python -m ruff check .`
46
- - `PYTHONPATH=src python -m mypy`
47
- - `PYTHONPATH=src python -m pytest`
48
- - `REDQUEUE_REDIS_URL=redis://127.0.0.1:6379/0 PYTHONPATH=src python -m pytest -m integration`
49
-
50
- ## [0.10.0] - 2026-06-20
51
-
52
- ### Added
53
-
54
- - Initial public release of RedQueue.
55
- - Synchronous `QueueClient` and asynchronous `AsyncQueueClient`.
56
- - Redis List backend with reliable processing, ack, nack, retry, recovery, and
57
- dead-letter support.
58
- - Redis Streams backend with consumer groups, ack, retry, dead-letter support,
59
- and pending recovery.
60
- - Delayed tasks based on Redis Sorted Set.
61
- - Redis version and capability detection through `INFO server`.
62
- - Unified exception hierarchy with structured context.
63
- - JSON serializer and custom serializer protocol.
64
- - Monitoring hook system with safe wrapper, in-memory hook, and composite hook.
65
- - Unit, contract, asynchronous, and opt-in Redis integration tests.
66
- - GitHub Actions CI and local quality check script.
67
-
68
- ### 新增
69
-
70
- - RedQueue 首个公开发布版本。
71
- - 同步 `QueueClient` 与异步 `AsyncQueueClient`。
72
- - Redis List 后端,支持可靠处理、ack、nack、retry、恢复和死信。
73
- - Redis Streams 后端,支持消费组、ack、retry、死信和 pending 恢复。
74
- - 基于 Redis Sorted Set 的延迟任务。
75
- - 通过 `INFO server` 进行 Redis 版本与能力探测。
76
- - 带结构化上下文的统一异常体系。
77
- - JSON 序列化器与自定义序列化协议。
78
- - 监控 hook 系统,包含安全包装、内存 hook 和组合 hook。
79
- - 单元测试、契约测试、异步测试和可选 Redis 集成测试。
80
- - GitHub Actions CI 与本地质量检查脚本。
81
-
82
- ### Compatibility
83
-
84
- - Python `>=3.9`.
85
- - Runtime dependency `redis==6.4.0`.
86
- - Redis Streams require Redis `>=5.0`.
87
- - Redis Streams `XAUTOCLAIM` and List `BLMOVE` are used when Redis `>=6.2`.
88
- - Delayed tasks use Redis Sorted Set.
89
-
90
- ### 兼容性
91
-
92
- - Python `>=3.9`。
93
- - 运行依赖 `redis==6.4.0`。
94
- - Redis Streams 要求 Redis `>=5.0`。
95
- - Redis `>=6.2` 时使用 Streams `XAUTOCLAIM` 与 List `BLMOVE`。
96
- - 延迟任务使用 Redis Sorted Set。
97
-
98
- ### Validation
99
-
100
- - `python -m ruff check .`
101
- - `PYTHONPATH=src python -m mypy`
102
- - `PYTHONPATH=src python -m pytest`
103
- - `REDQUEUE_REDIS_URL=redis://127.0.0.1:6379/0 PYTHONPATH=src python -m pytest -m integration`
104
-
105
- ### 验证
106
-
107
- - `python -m ruff check .`
108
- - `PYTHONPATH=src python -m mypy`
109
- - `PYTHONPATH=src python -m pytest`
110
- - `REDQUEUE_REDIS_URL=redis://127.0.0.1:6379/0 PYTHONPATH=src python -m pytest -m integration`
22
+ - 修复同步和异步 `from_url()` 在自动创建 Redis 连接后,如果 Redis 能力探测、
23
+ 配置校验或后端初始化失败,已创建连接未释放的问题。
24
+ - 同步和异步 `from_url()` 新增显式 `owns_redis` 覆盖支持,用于高级资源所有权
25
+ 控制。
26
+
27
+ ## [0.11.0] - 2026-06-21
28
+
29
+ ### Added
30
+
31
+ - Added synchronous `RedisConnectionManager` and asynchronous
32
+ `AsyncRedisConnectionManager` for shared Redis connection pool ownership.
33
+ - Added client context manager support for explicit sync and async resource
34
+ cleanup.
35
+ - Added `connection_manager` and `pool_options` support to sync and async
36
+ `from_url` constructors.
37
+ - Added `README-zh-CN.md` and converted `README.md` to English-only content.
38
+ - Added `CONTRIBUTING.md` with the project branch model and contribution
39
+ workflow.
40
+ - Added `CODE_OF_CONDUCT.md`.
41
+
42
+ ### Changed
43
+
44
+ - Updated formal release version to `0.11.0`.
45
+ - Documented the branch model: `main`, `develop`, `feature/*`, `release/*`,
46
+ and `hotfix/*`.
47
+
48
+ ### 新增
49
+
50
+ - 新增同步 `RedisConnectionManager` 和异步 `AsyncRedisConnectionManager`,
51
+ 用于共享 Redis 连接池所有权管理。
52
+ - 新增客户端上下文管理器支持,用于显式释放同步和异步资源。
53
+ - 同步和异步 `from_url` 构造器新增 `connection_manager` 和 `pool_options`
54
+ 支持。
55
+ - 新增 `README-zh-CN.md`,并将 `README.md` 调整为纯英文文档。
56
+ - 新增 `CONTRIBUTING.md`,记录项目分支模型和贡献流程。
57
+ - 新增 `CODE_OF_CONDUCT.md`。
58
+
59
+ ### 变更
60
+
61
+ - 正式版本更新为 `0.11.0`。
62
+ - 记录分支模型:`main`、`develop`、`feature/*`、`release/*` 和 `hotfix/*`。
63
+
64
+ ## [0.10.1] - 2026-06-20
65
+
66
+ ### Fixed
67
+
68
+ - Fixed Redis List `ack`, `nack`, `retry`, and dead-letter requeue when custom
69
+ serializers do not produce deterministic bytes.
70
+ - Fixed delayed task scheduling cleanup so payload keys are removed if `ZADD`
71
+ fails after `SET`.
72
+ - Fixed Streams dead-letter reads and moves by ensuring the consumer group also
73
+ exists on the dead-letter stream.
74
+ - Fixed async client creation monitoring so `AsyncQueueClient` emits the same
75
+ `client.created` event as the synchronous client.
76
+ - Removed duplicate delay scheduling monitoring events from the synchronous
77
+ client facade.
78
+ - Normalized internal Redis Streams entry ids returned as bytes.
79
+
80
+ ### 修复
81
+
82
+ - 修复自定义序列化器输出字节不稳定时,Redis List `ack`、`nack`、`retry`
83
+ 和死信重放无法精确删除原始消息的问题。
84
+ - 修复延迟任务在 `SET` 成功但 `ZADD` 失败时残留 payload key 的问题。
85
+ - 修复 Streams 死信读取和搬移前未确保死信 stream 消费组存在的问题。
86
+ - 修复异步客户端创建时未与同步客户端一致发出 `client.created` 监控事件的问题。
87
+ - 移除同步客户端门面层重复发出的延迟调度监控事件。
88
+ - 统一规范化 Redis Streams 返回的 bytes 类型 entry id。
89
+
90
+ ### Validation
91
+
92
+ - `python -m ruff check .`
93
+ - `PYTHONPATH=src python -m mypy`
94
+ - `PYTHONPATH=src python -m pytest`
95
+ - `REDQUEUE_REDIS_URL=redis://127.0.0.1:6379/0 PYTHONPATH=src python -m pytest -m integration`
96
+
97
+ ### 验证
98
+
99
+ - `python -m ruff check .`
100
+ - `PYTHONPATH=src python -m mypy`
101
+ - `PYTHONPATH=src python -m pytest`
102
+ - `REDQUEUE_REDIS_URL=redis://127.0.0.1:6379/0 PYTHONPATH=src python -m pytest -m integration`
103
+
104
+ ## [0.10.0] - 2026-06-20
105
+
106
+ ### Added
107
+
108
+ - Initial public release of RedQueue.
109
+ - Synchronous `QueueClient` and asynchronous `AsyncQueueClient`.
110
+ - Redis List backend with reliable processing, ack, nack, retry, recovery, and
111
+ dead-letter support.
112
+ - Redis Streams backend with consumer groups, ack, retry, dead-letter support,
113
+ and pending recovery.
114
+ - Delayed tasks based on Redis Sorted Set.
115
+ - Redis version and capability detection through `INFO server`.
116
+ - Unified exception hierarchy with structured context.
117
+ - JSON serializer and custom serializer protocol.
118
+ - Monitoring hook system with safe wrapper, in-memory hook, and composite hook.
119
+ - Unit, contract, asynchronous, and opt-in Redis integration tests.
120
+ - GitHub Actions CI and local quality check script.
121
+
122
+ ### 新增
123
+
124
+ - RedQueue 首个公开发布版本。
125
+ - 同步 `QueueClient` 与异步 `AsyncQueueClient`。
126
+ - Redis List 后端,支持可靠处理、ack、nack、retry、恢复和死信。
127
+ - Redis Streams 后端,支持消费组、ack、retry、死信和 pending 恢复。
128
+ - 基于 Redis Sorted Set 的延迟任务。
129
+ - 通过 `INFO server` 进行 Redis 版本与能力探测。
130
+ - 带结构化上下文的统一异常体系。
131
+ - JSON 序列化器与自定义序列化协议。
132
+ - 监控 hook 系统,包含安全包装、内存 hook 和组合 hook。
133
+ - 单元测试、契约测试、异步测试和可选 Redis 集成测试。
134
+ - GitHub Actions CI 与本地质量检查脚本。
135
+
136
+ ### Compatibility
137
+
138
+ - Python `>=3.9`.
139
+ - Runtime dependency `redis==6.4.0`.
140
+ - Redis Streams require Redis `>=5.0`.
141
+ - Redis Streams `XAUTOCLAIM` and List `BLMOVE` are used when Redis `>=6.2`.
142
+ - Delayed tasks use Redis Sorted Set.
143
+
144
+ ### 兼容性
145
+
146
+ - Python `>=3.9`。
147
+ - 运行依赖 `redis==6.4.0`。
148
+ - Redis Streams 要求 Redis `>=5.0`。
149
+ - Redis `>=6.2` 时使用 Streams `XAUTOCLAIM` 与 List `BLMOVE`。
150
+ - 延迟任务使用 Redis Sorted Set。
151
+
152
+ ### Validation
153
+
154
+ - `python -m ruff check .`
155
+ - `PYTHONPATH=src python -m mypy`
156
+ - `PYTHONPATH=src python -m pytest`
157
+ - `REDQUEUE_REDIS_URL=redis://127.0.0.1:6379/0 PYTHONPATH=src python -m pytest -m integration`
158
+
159
+ ### 验证
160
+
161
+ - `python -m ruff check .`
162
+ - `PYTHONPATH=src python -m mypy`
163
+ - `PYTHONPATH=src python -m pytest`
164
+ - `REDQUEUE_REDIS_URL=redis://127.0.0.1:6379/0 PYTHONPATH=src python -m pytest -m integration`
@@ -0,0 +1,40 @@
1
+ # Code of Conduct
2
+
3
+ RedQueue follows a simple contributor covenant: be respectful, direct, and
4
+ focused on improving the project.
5
+
6
+ ## Expected Behavior
7
+
8
+ - Use welcoming and inclusive language.
9
+ - Be respectful of different experience levels and viewpoints.
10
+ - Give and receive technical feedback with concrete reasoning.
11
+ - Keep discussions focused on the code, documentation, tests, and project
12
+ outcomes.
13
+ - Assume good intent, but correct issues clearly when they affect quality,
14
+ safety, or maintainability.
15
+
16
+ ## Unacceptable Behavior
17
+
18
+ - Harassment, threats, insults, or discriminatory language.
19
+ - Personal attacks or sustained disruption of project discussions.
20
+ - Publishing private information without explicit permission.
21
+ - Sharing credentials, tokens, or sensitive operational data.
22
+ - Any behavior that makes collaboration unsafe or unproductive.
23
+
24
+ ## Scope
25
+
26
+ This code of conduct applies in project repositories, issues, pull requests,
27
+ discussion channels, release processes, and other spaces representing RedQueue.
28
+
29
+ ## Enforcement
30
+
31
+ Maintainers may remove comments, close issues, reject pull requests, or restrict
32
+ participation when behavior violates this code of conduct. Enforcement should be
33
+ proportional, documented where appropriate, and focused on restoring productive
34
+ collaboration.
35
+
36
+ ## Reporting
37
+
38
+ Report issues through the project issue tracker or by contacting the maintainer
39
+ listed in the project metadata. Do not include sensitive personal information in
40
+ public reports.
@@ -0,0 +1,87 @@
1
+ # Contributing to RedQueue
2
+
3
+ Thank you for contributing to RedQueue. This project favors small, well-tested
4
+ changes that preserve Redis compatibility and clear resource ownership.
5
+
6
+ ## Branch Model
7
+
8
+ RedQueue uses a lightweight Git Flow model:
9
+
10
+ - `main`: stable release branch and the latest formal release. Release branches
11
+ and urgent hotfixes merge here.
12
+ - `develop`: integration branch for the next minor release.
13
+ - `feature/<name>`: feature branches created from `develop` and merged back to
14
+ `develop`.
15
+ - `release/<minor>`: release stabilization branches such as `release/0.11`.
16
+ - `hotfix/<version>`: urgent patch branches created from `main`, then merged
17
+ back to both `main` and `develop`.
18
+
19
+ ## Workflow
20
+
21
+ 1. Create feature branches from `develop`.
22
+ 2. Keep changes focused and avoid unrelated refactors.
23
+ 3. Add or update tests for behavioral changes.
24
+ 4. Update documentation when public APIs or workflows change.
25
+ 5. Open a pull request into `develop` for regular work, or into the active
26
+ `release/<minor>` branch for release stabilization fixes.
27
+ 6. After a release is stabilized, merge `release/<minor>` into `main`, tag the
28
+ release from `main`, and publish the package.
29
+
30
+ ## Versioning
31
+
32
+ - Development versions use `0.1x.xdevN`.
33
+ - Formal releases use `0.1x.x`.
34
+ - Development and formal release version streams are independent.
35
+ - Patch releases fix defects.
36
+ - Minor releases may add compatible features.
37
+
38
+ ## Quality Checks
39
+
40
+ Run the local quality gate before opening a pull request:
41
+
42
+ ```bash
43
+ PYTHONPATH=src python scripts/check.py
44
+ ```
45
+
46
+ Run Redis integration tests when Redis behavior changes:
47
+
48
+ ```bash
49
+ REDQUEUE_REDIS_URL=redis://127.0.0.1:6379/0 PYTHONPATH=src python -m pytest -m integration
50
+ ```
51
+
52
+ Run real Redis availability and performance tests when queue reliability or
53
+ connection behavior changes:
54
+
55
+ ```bash
56
+ REDQUEUE_REDIS_URL=redis://127.0.0.1:6379/0 PYTHONPATH=src python -m pytest -m "integration and availability"
57
+ REDQUEUE_REDIS_URL=redis://127.0.0.1:6379/0 PYTHONPATH=src python -m pytest -m "integration and performance"
58
+ ```
59
+
60
+ ## Python Source Requirements
61
+
62
+ Every Python source file must include:
63
+
64
+ ```python
65
+ # SPDX-License-Identifier: Apache-2.0
66
+ # Author: SpringMirror-pear
67
+ ```
68
+
69
+ Use Google-style docstrings for public classes, functions, and non-trivial
70
+ internal helpers.
71
+
72
+ ## Compatibility Expectations
73
+
74
+ - Python runtime support starts at `>=3.9`.
75
+ - Redis Streams require Redis `>=5.0`.
76
+ - Redis 5.x must continue to use `XPENDING`/`XCLAIM` fallback for pending
77
+ recovery.
78
+ - Redis `>=6.2` may use `XAUTOCLAIM` and `BLMOVE`.
79
+ - Keep sync and async APIs aligned unless there is a documented reason not to.
80
+
81
+ ## Pull Request Checklist
82
+
83
+ - Tests cover the changed behavior.
84
+ - `ruff`, `mypy`, and `pytest` pass.
85
+ - Public docs are updated when public behavior changes.
86
+ - Changelog entries are added for release branches.
87
+ - No credentials, tokens, local Redis data, or build artifacts are committed.