wexample-queue 2.0.4__tar.gz → 2.0.6__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,111 @@
1
+ Metadata-Version: 2.1
2
+ Name: wexample-queue
3
+ Version: 2.0.6
4
+ Summary: Manage Queuing
5
+ Author-Email: weeger <contact@wexample.com>
6
+ License: MIT
7
+ Classifier: Programming Language :: Python :: 3
8
+ Classifier: License :: OSI Approved :: MIT License
9
+ Classifier: Operating System :: OS Independent
10
+ Requires-Python: >=3.10
11
+ Requires-Dist: pika>=1.3.0
12
+ Requires-Dist: wexample-app>=19.4.2
13
+ Requires-Dist: wexample-helpers>=20.6.0
14
+ Provides-Extra: dev
15
+ Requires-Dist: pytest; extra == "dev"
16
+ Requires-Dist: pytest-cov; extra == "dev"
17
+ Description-Content-Type: text/markdown
18
+
19
+ # queue
20
+
21
+ Version: 2.0.6
22
+
23
+ Manage Queuing
24
+
25
+ ## Table of Contents
26
+
27
+ - [Install](#install)
28
+ - [Tests](#tests)
29
+ - [Roadmap](#roadmap)
30
+ - [Status Compatibility](#status-compatibility)
31
+ - [Useful Links](#useful-links)
32
+
33
+ ## Installation
34
+
35
+ ```bash
36
+ pip install wexample-queue
37
+ ```
38
+
39
+ Requires Python >=3.10.
40
+
41
+ ## Tests
42
+
43
+ This project uses `pytest` for testing and `pytest-cov` for code coverage analysis.
44
+
45
+ ### Installation
46
+
47
+ First, install the required testing dependencies:
48
+ ```bash
49
+ .venv/bin/python -m pip install pytest pytest-cov
50
+ ```
51
+
52
+ ### Basic Usage
53
+
54
+ Run all tests with coverage:
55
+ ```bash
56
+ .venv/bin/python -m pytest --cov --cov-report=html
57
+ ```
58
+
59
+ ### Common Commands
60
+ ```bash
61
+ # Run tests with coverage for a specific module
62
+ .venv/bin/python -m pytest --cov=your_module
63
+
64
+ # Show which lines are not covered
65
+ .venv/bin/python -m pytest --cov=your_module --cov-report=term-missing
66
+
67
+ # Generate an HTML coverage report
68
+ .venv/bin/python -m pytest --cov=your_module --cov-report=html
69
+
70
+ # Combine terminal and HTML reports
71
+ .venv/bin/python -m pytest --cov=your_module --cov-report=term-missing --cov-report=html
72
+
73
+ # Run specific test file with coverage
74
+ .venv/bin/python -m pytest tests/test_file.py --cov=your_module --cov-report=term-missing
75
+ ```
76
+
77
+ ### Viewing HTML Reports
78
+
79
+ After generating an HTML report, open `htmlcov/index.html` in your browser to view detailed line-by-line coverage information.
80
+
81
+ ### Coverage Threshold
82
+
83
+ To enforce a minimum coverage percentage:
84
+ ```bash
85
+ .venv/bin/python -m pytest --cov=your_module --cov-fail-under=80
86
+ ```
87
+
88
+ This will cause the test suite to fail if coverage drops below 80%.
89
+
90
+ ## Known Limitations & Roadmap
91
+
92
+ Current limitations and planned features are tracked in the GitHub issues.
93
+
94
+ See the [project roadmap](https://github.com/wexample/python-queue/issues) for upcoming features and improvements.
95
+
96
+ ## Status & Compatibility
97
+
98
+ **Maturity**: Production-ready
99
+
100
+ **Python Support**: >=3.10
101
+
102
+ **OS Support**: Linux, macOS, Windows
103
+
104
+ **Status**: Actively maintained
105
+
106
+ ## Useful Links
107
+
108
+ - **Homepage**: https://github.com/wexample/python-queue
109
+ - **Issue Tracker**: https://github.com/wexample/python-queue/issues
110
+ - **Discussions**: https://github.com/wexample/python-queue/discussions
111
+ - **PyPI**: [pypi.org/project/wexample-queue](https://pypi.org/project/wexample-queue/)
@@ -0,0 +1,93 @@
1
+ # queue
2
+
3
+ Version: 2.0.6
4
+
5
+ Manage Queuing
6
+
7
+ ## Table of Contents
8
+
9
+ - [Install](#install)
10
+ - [Tests](#tests)
11
+ - [Roadmap](#roadmap)
12
+ - [Status Compatibility](#status-compatibility)
13
+ - [Useful Links](#useful-links)
14
+
15
+ ## Installation
16
+
17
+ ```bash
18
+ pip install wexample-queue
19
+ ```
20
+
21
+ Requires Python >=3.10.
22
+
23
+ ## Tests
24
+
25
+ This project uses `pytest` for testing and `pytest-cov` for code coverage analysis.
26
+
27
+ ### Installation
28
+
29
+ First, install the required testing dependencies:
30
+ ```bash
31
+ .venv/bin/python -m pip install pytest pytest-cov
32
+ ```
33
+
34
+ ### Basic Usage
35
+
36
+ Run all tests with coverage:
37
+ ```bash
38
+ .venv/bin/python -m pytest --cov --cov-report=html
39
+ ```
40
+
41
+ ### Common Commands
42
+ ```bash
43
+ # Run tests with coverage for a specific module
44
+ .venv/bin/python -m pytest --cov=your_module
45
+
46
+ # Show which lines are not covered
47
+ .venv/bin/python -m pytest --cov=your_module --cov-report=term-missing
48
+
49
+ # Generate an HTML coverage report
50
+ .venv/bin/python -m pytest --cov=your_module --cov-report=html
51
+
52
+ # Combine terminal and HTML reports
53
+ .venv/bin/python -m pytest --cov=your_module --cov-report=term-missing --cov-report=html
54
+
55
+ # Run specific test file with coverage
56
+ .venv/bin/python -m pytest tests/test_file.py --cov=your_module --cov-report=term-missing
57
+ ```
58
+
59
+ ### Viewing HTML Reports
60
+
61
+ After generating an HTML report, open `htmlcov/index.html` in your browser to view detailed line-by-line coverage information.
62
+
63
+ ### Coverage Threshold
64
+
65
+ To enforce a minimum coverage percentage:
66
+ ```bash
67
+ .venv/bin/python -m pytest --cov=your_module --cov-fail-under=80
68
+ ```
69
+
70
+ This will cause the test suite to fail if coverage drops below 80%.
71
+
72
+ ## Known Limitations & Roadmap
73
+
74
+ Current limitations and planned features are tracked in the GitHub issues.
75
+
76
+ See the [project roadmap](https://github.com/wexample/python-queue/issues) for upcoming features and improvements.
77
+
78
+ ## Status & Compatibility
79
+
80
+ **Maturity**: Production-ready
81
+
82
+ **Python Support**: >=3.10
83
+
84
+ **OS Support**: Linux, macOS, Windows
85
+
86
+ **Status**: Actively maintained
87
+
88
+ ## Useful Links
89
+
90
+ - **Homepage**: https://github.com/wexample/python-queue
91
+ - **Issue Tracker**: https://github.com/wexample/python-queue/issues
92
+ - **Discussions**: https://github.com/wexample/python-queue/discussions
93
+ - **PyPI**: [pypi.org/project/wexample-queue](https://pypi.org/project/wexample-queue/)
@@ -6,7 +6,7 @@ build-backend = "pdm.backend"
6
6
 
7
7
  [project]
8
8
  name = "wexample-queue"
9
- version = "2.0.4"
9
+ version = "2.0.6"
10
10
  description = "Manage Queuing"
11
11
  authors = [
12
12
  { name = "weeger", email = "contact@wexample.com" },
@@ -19,8 +19,8 @@ classifiers = [
19
19
  ]
20
20
  dependencies = [
21
21
  "pika>=1.3.0",
22
- "wexample-app>=19.4.0",
23
- "wexample-helpers>=20.5.0",
22
+ "wexample-app>=19.4.2",
23
+ "wexample-helpers>=20.6.0",
24
24
  ]
25
25
 
26
26
  [project.readme]
@@ -1,260 +0,0 @@
1
- Metadata-Version: 2.1
2
- Name: wexample-queue
3
- Version: 2.0.4
4
- Summary: Manage Queuing
5
- Author-Email: weeger <contact@wexample.com>
6
- License: MIT
7
- Classifier: Programming Language :: Python :: 3
8
- Classifier: License :: OSI Approved :: MIT License
9
- Classifier: Operating System :: OS Independent
10
- Requires-Python: >=3.10
11
- Requires-Dist: pika>=1.3.0
12
- Requires-Dist: wexample-app>=19.4.0
13
- Requires-Dist: wexample-helpers>=20.5.0
14
- Provides-Extra: dev
15
- Requires-Dist: pytest; extra == "dev"
16
- Requires-Dist: pytest-cov; extra == "dev"
17
- Description-Content-Type: text/markdown
18
-
19
- # queue
20
-
21
- Version: 2.0.4
22
-
23
- `wexample-queue` is what a worker needs to live on a RabbitMQ queue and nothing more: a connector holding the broker connection, and a service base whose whole subject is one queue. A subclass writes the name of the queue and what to do with a message; connecting, declaring, decoding, acknowledging and giving up are the same for every worker and are already written.
24
-
25
- It exists because the other end of the queue is not always Python. The body of a message is plain JSON, published on the default exchange with the queue name as routing key — which is where a Symfony Messenger transport declaring that same queue binds its own exchange, so both ends meet in the same place without either knowing the other.
26
-
27
- ## A worker
28
-
29
- ```python
30
- from wexample_queue.service.abstract_queue_service import AbstractQueueService
31
-
32
- @base_class
33
- class ProcessRunService(AbstractQueueService):
34
- queue_name: str = public_field(
35
- default="process_run",
36
- description="Name of the queue this service consumes",
37
- )
38
-
39
- def process_message(self, message: dict[str, Any]) -> None:
40
- self.log(f"Run {message['id']} asked for in {message['workdir']}")
41
- ```
42
-
43
- Calling `start()` opens the connection, declares the queue and blocks consuming
44
- until `stop()`. Returning from `process_message()` acknowledges the message;
45
- raising rejects it without putting it back, because requeueing a message that
46
- just failed is asking for the same failure at once and for ever. Where it goes
47
- then is the broker's business — a dead letter exchange if the queue has one,
48
- nowhere if it has not.
49
-
50
- ## Publishing
51
-
52
- ```python
53
- self.connector.publish("process_run_event", {"kind": "process_run", "id": run_id})
54
- ```
55
-
56
- ## The broker
57
-
58
- Where the broker is comes from the environment, under four keys the connector
59
- declares as expected:
60
-
61
- ```
62
- RABBITMQ_HOST
63
- RABBITMQ_PORT
64
- RABBITMQ_USER
65
- RABBITMQ_PASSWORD
66
- ```
67
-
68
- Reading them from there rather than from a caller is what keeps a worker and
69
- whoever publishes to it from holding two addresses that could disagree.
70
-
71
- ## Table of Contents
72
-
73
- - [A worker](#a-worker)
74
- - [Publishing](#publishing)
75
- - [The broker](#the-broker)
76
- - [Installation](#installation)
77
- - [Tests](#tests)
78
- - [Architecture](#architecture)
79
- - [Integration in the Suite](#integration-in-the-suite)
80
- - [Dependencies](#dependencies)
81
- - [Versioning & Compatibility Policy](#versioning--compatibility-policy)
82
- - [License](#license)
83
- - [About us](#about-us)
84
- - [Known Limitations & Roadmap](#known-limitations--roadmap)
85
- - [Status & Compatibility](#status--compatibility)
86
- - [Useful Links](#useful-links)
87
- - [Migration Notes](#migration-notes)
88
-
89
- ## Installation
90
-
91
- ```bash
92
- pip install wexample-queue
93
- ```
94
-
95
- Requires Python >=3.10.
96
-
97
- ```bash
98
- pip install wexample-queue
99
- ```
100
-
101
- A worker is a class with a queue name and a `process_message()`:
102
-
103
- ```python
104
- from typing import Any
105
-
106
- from wexample_helpers.classes.field import public_field
107
- from wexample_helpers.decorator.base_class import base_class
108
- from wexample_queue.service.abstract_queue_service import AbstractQueueService
109
-
110
- @base_class
111
- class HelloService(AbstractQueueService):
112
- queue_name: str = public_field(
113
- default="hello",
114
- description="Name of the queue this service consumes",
115
- )
116
-
117
- def process_message(self, message: dict[str, Any]) -> None:
118
- self.log(f"Got {message}")
119
-
120
- HelloService(kernel=kernel, queue_name="hello").start()
121
- ```
122
-
123
- `start()` blocks. The four `RABBITMQ_*` environment keys have to be readable by
124
- the kernel, which is where the connector goes to find the broker.
125
-
126
- ## Tests
127
-
128
- This project uses `pytest` for testing and `pytest-cov` for code coverage analysis.
129
-
130
- ### Installation
131
-
132
- First, install the required testing dependencies:
133
- ```bash
134
- .venv/bin/python -m pip install pytest pytest-cov
135
- ```
136
-
137
- ### Basic Usage
138
-
139
- Run all tests with coverage:
140
- ```bash
141
- .venv/bin/python -m pytest --cov --cov-report=html
142
- ```
143
-
144
- ### Common Commands
145
- ```bash
146
- # Run tests with coverage for a specific module
147
- .venv/bin/python -m pytest --cov=your_module
148
-
149
- # Show which lines are not covered
150
- .venv/bin/python -m pytest --cov=your_module --cov-report=term-missing
151
-
152
- # Generate an HTML coverage report
153
- .venv/bin/python -m pytest --cov=your_module --cov-report=html
154
-
155
- # Combine terminal and HTML reports
156
- .venv/bin/python -m pytest --cov=your_module --cov-report=term-missing --cov-report=html
157
-
158
- # Run specific test file with coverage
159
- .venv/bin/python -m pytest tests/test_file.py --cov=your_module --cov-report=term-missing
160
- ```
161
-
162
- ### Viewing HTML Reports
163
-
164
- After generating an HTML report, open `htmlcov/index.html` in your browser to view detailed line-by-line coverage information.
165
-
166
- ### Coverage Threshold
167
-
168
- To enforce a minimum coverage percentage:
169
- ```bash
170
- .venv/bin/python -m pytest --cov=your_module --cov-fail-under=80
171
- ```
172
-
173
- This will cause the test suite to fail if coverage drops below 80%.
174
-
175
- ## Architecture
176
-
177
- Two classes, and the line between them is what a broker is against what a worker is.
178
-
179
- ### The connector
180
-
181
- src/wexample_queue/connector/rabbitmq_external_connector.py extends `AbstractExternalConnector` from `wexample-app` and holds a `pika.BlockingConnection` and its channel. It exposes only what this package needs — `connect`, `disconnect`, `declare_queue`, `publish`, `consume`, `stop_consuming` — and reads the broker address from four environment keys it declares in `get_expected_env_keys()`, so a worker never carries one.
182
-
183
- `publish()` goes through the default exchange with the queue name as routing key, and marks the message persistent. `declare_queue()` declares it durable, with the same arguments both ends use: neither side depends on the other having started first, and a broker restarted on its own finds its queues again.
184
-
185
- ### The service
186
-
187
- src/wexample_queue/service/abstract_queue_service.py extends `AbstractService` from `wexample-app`, which already brings the run loop, the signal handling and the shutdown. What this adds is the queue: `start()` opens the connection and declares the queue before handing over to the loop, `_run()` blocks consuming, and `_on_message()` decodes one delivery and answers the broker for it.
188
-
189
- The answer is the part worth reading. A body that is not JSON, and a message `process_message()` raised on, are both rejected with `requeue=False`. Putting such a message back would be asking for the same failure immediately and for ever; dropping it silently with an `ack` would lose it without saying so. Rejecting it hands the decision to the broker, which is the only place a dead letter exchange can be configured.
190
-
191
- Unlike the implementation this was drawn from, constructing a service does not start it. `start()` is called by whoever owns the worker, which is what makes a service testable without a broker.
192
-
193
- ## Integration in the Suite
194
-
195
- This package is part of the Wexample Suite — a collection of high-quality, modular tools designed to work seamlessly together across multiple languages and environments.
196
-
197
- ### Related Packages
198
-
199
- The suite includes packages for configuration management, file handling, prompts, and more. Each package can be used independently or as part of the integrated suite.
200
-
201
- ## Dependencies
202
-
203
- - pika: >=1.3.0
204
- - wexample-app: >=19.4.0
205
- - wexample-helpers: >=20.5.0
206
-
207
- ## Versioning & Compatibility Policy
208
-
209
- Wexample packages follow **Semantic Versioning** (SemVer):
210
-
211
- - **MAJOR**: Breaking changes
212
- - **MINOR**: New features, backward compatible
213
- - **PATCH**: Bug fixes, backward compatible
214
-
215
- We maintain backward compatibility within major versions and provide clear migration guides for breaking changes.
216
-
217
- ## License
218
-
219
- This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
220
-
221
- Free to use in both personal and commercial projects.
222
-
223
- ## About us
224
-
225
- [Wexample](https://wexample.com) stands as a cornerstone of the digital ecosystem — a collective of seasoned engineers, researchers, and creators driven by a relentless pursuit of technological excellence. More than a media platform, it has grown into a vibrant community where innovation meets craftsmanship, and where every line of code reflects a commitment to clarity, durability, and shared intelligence.
226
-
227
- This packages suite embodies this spirit. Trusted by professionals and enthusiasts alike, it delivers a consistent, high-quality foundation for modern development — open, elegant, and battle-tested. Its reputation is built on years of collaboration, refinement, and rigorous attention to detail, making it a natural choice for those who demand both robustness and beauty in their tools.
228
-
229
- Wexample cultivates a culture of mastery. Each package, each contribution carries the mark of a community that values precision, ethics, and innovation — a community proud to shape the future of digital craftsmanship.
230
-
231
- Built and maintained by [Romain Weeger](https://weeger.io).
232
-
233
- ## Known Limitations & Roadmap
234
-
235
- Current limitations and planned features are tracked in the GitHub issues.
236
-
237
- See the [project roadmap](https://github.com/wexample/python-queue/issues) for upcoming features and improvements.
238
-
239
- ## Status & Compatibility
240
-
241
- **Maturity**: Production-ready
242
-
243
- **Python Support**: >=3.10
244
-
245
- **OS Support**: Linux, macOS, Windows
246
-
247
- **Status**: Actively maintained
248
-
249
- ## Useful Links
250
-
251
- - **Homepage**: https://github.com/wexample/python-queue
252
- - **Issue Tracker**: https://github.com/wexample/python-queue/issues
253
- - **Discussions**: https://github.com/wexample/python-queue/discussions
254
- - **PyPI**: [pypi.org/project/wexample-queue](https://pypi.org/project/wexample-queue/)
255
-
256
- ## Migration Notes
257
-
258
- When upgrading between major versions, refer to the migration guides in the documentation.
259
-
260
- Breaking changes are clearly documented with upgrade paths and examples.
@@ -1,242 +0,0 @@
1
- # queue
2
-
3
- Version: 2.0.4
4
-
5
- `wexample-queue` is what a worker needs to live on a RabbitMQ queue and nothing more: a connector holding the broker connection, and a service base whose whole subject is one queue. A subclass writes the name of the queue and what to do with a message; connecting, declaring, decoding, acknowledging and giving up are the same for every worker and are already written.
6
-
7
- It exists because the other end of the queue is not always Python. The body of a message is plain JSON, published on the default exchange with the queue name as routing key — which is where a Symfony Messenger transport declaring that same queue binds its own exchange, so both ends meet in the same place without either knowing the other.
8
-
9
- ## A worker
10
-
11
- ```python
12
- from wexample_queue.service.abstract_queue_service import AbstractQueueService
13
-
14
- @base_class
15
- class ProcessRunService(AbstractQueueService):
16
- queue_name: str = public_field(
17
- default="process_run",
18
- description="Name of the queue this service consumes",
19
- )
20
-
21
- def process_message(self, message: dict[str, Any]) -> None:
22
- self.log(f"Run {message['id']} asked for in {message['workdir']}")
23
- ```
24
-
25
- Calling `start()` opens the connection, declares the queue and blocks consuming
26
- until `stop()`. Returning from `process_message()` acknowledges the message;
27
- raising rejects it without putting it back, because requeueing a message that
28
- just failed is asking for the same failure at once and for ever. Where it goes
29
- then is the broker's business — a dead letter exchange if the queue has one,
30
- nowhere if it has not.
31
-
32
- ## Publishing
33
-
34
- ```python
35
- self.connector.publish("process_run_event", {"kind": "process_run", "id": run_id})
36
- ```
37
-
38
- ## The broker
39
-
40
- Where the broker is comes from the environment, under four keys the connector
41
- declares as expected:
42
-
43
- ```
44
- RABBITMQ_HOST
45
- RABBITMQ_PORT
46
- RABBITMQ_USER
47
- RABBITMQ_PASSWORD
48
- ```
49
-
50
- Reading them from there rather than from a caller is what keeps a worker and
51
- whoever publishes to it from holding two addresses that could disagree.
52
-
53
- ## Table of Contents
54
-
55
- - [A worker](#a-worker)
56
- - [Publishing](#publishing)
57
- - [The broker](#the-broker)
58
- - [Installation](#installation)
59
- - [Tests](#tests)
60
- - [Architecture](#architecture)
61
- - [Integration in the Suite](#integration-in-the-suite)
62
- - [Dependencies](#dependencies)
63
- - [Versioning & Compatibility Policy](#versioning--compatibility-policy)
64
- - [License](#license)
65
- - [About us](#about-us)
66
- - [Known Limitations & Roadmap](#known-limitations--roadmap)
67
- - [Status & Compatibility](#status--compatibility)
68
- - [Useful Links](#useful-links)
69
- - [Migration Notes](#migration-notes)
70
-
71
- ## Installation
72
-
73
- ```bash
74
- pip install wexample-queue
75
- ```
76
-
77
- Requires Python >=3.10.
78
-
79
- ```bash
80
- pip install wexample-queue
81
- ```
82
-
83
- A worker is a class with a queue name and a `process_message()`:
84
-
85
- ```python
86
- from typing import Any
87
-
88
- from wexample_helpers.classes.field import public_field
89
- from wexample_helpers.decorator.base_class import base_class
90
- from wexample_queue.service.abstract_queue_service import AbstractQueueService
91
-
92
- @base_class
93
- class HelloService(AbstractQueueService):
94
- queue_name: str = public_field(
95
- default="hello",
96
- description="Name of the queue this service consumes",
97
- )
98
-
99
- def process_message(self, message: dict[str, Any]) -> None:
100
- self.log(f"Got {message}")
101
-
102
- HelloService(kernel=kernel, queue_name="hello").start()
103
- ```
104
-
105
- `start()` blocks. The four `RABBITMQ_*` environment keys have to be readable by
106
- the kernel, which is where the connector goes to find the broker.
107
-
108
- ## Tests
109
-
110
- This project uses `pytest` for testing and `pytest-cov` for code coverage analysis.
111
-
112
- ### Installation
113
-
114
- First, install the required testing dependencies:
115
- ```bash
116
- .venv/bin/python -m pip install pytest pytest-cov
117
- ```
118
-
119
- ### Basic Usage
120
-
121
- Run all tests with coverage:
122
- ```bash
123
- .venv/bin/python -m pytest --cov --cov-report=html
124
- ```
125
-
126
- ### Common Commands
127
- ```bash
128
- # Run tests with coverage for a specific module
129
- .venv/bin/python -m pytest --cov=your_module
130
-
131
- # Show which lines are not covered
132
- .venv/bin/python -m pytest --cov=your_module --cov-report=term-missing
133
-
134
- # Generate an HTML coverage report
135
- .venv/bin/python -m pytest --cov=your_module --cov-report=html
136
-
137
- # Combine terminal and HTML reports
138
- .venv/bin/python -m pytest --cov=your_module --cov-report=term-missing --cov-report=html
139
-
140
- # Run specific test file with coverage
141
- .venv/bin/python -m pytest tests/test_file.py --cov=your_module --cov-report=term-missing
142
- ```
143
-
144
- ### Viewing HTML Reports
145
-
146
- After generating an HTML report, open `htmlcov/index.html` in your browser to view detailed line-by-line coverage information.
147
-
148
- ### Coverage Threshold
149
-
150
- To enforce a minimum coverage percentage:
151
- ```bash
152
- .venv/bin/python -m pytest --cov=your_module --cov-fail-under=80
153
- ```
154
-
155
- This will cause the test suite to fail if coverage drops below 80%.
156
-
157
- ## Architecture
158
-
159
- Two classes, and the line between them is what a broker is against what a worker is.
160
-
161
- ### The connector
162
-
163
- src/wexample_queue/connector/rabbitmq_external_connector.py extends `AbstractExternalConnector` from `wexample-app` and holds a `pika.BlockingConnection` and its channel. It exposes only what this package needs — `connect`, `disconnect`, `declare_queue`, `publish`, `consume`, `stop_consuming` — and reads the broker address from four environment keys it declares in `get_expected_env_keys()`, so a worker never carries one.
164
-
165
- `publish()` goes through the default exchange with the queue name as routing key, and marks the message persistent. `declare_queue()` declares it durable, with the same arguments both ends use: neither side depends on the other having started first, and a broker restarted on its own finds its queues again.
166
-
167
- ### The service
168
-
169
- src/wexample_queue/service/abstract_queue_service.py extends `AbstractService` from `wexample-app`, which already brings the run loop, the signal handling and the shutdown. What this adds is the queue: `start()` opens the connection and declares the queue before handing over to the loop, `_run()` blocks consuming, and `_on_message()` decodes one delivery and answers the broker for it.
170
-
171
- The answer is the part worth reading. A body that is not JSON, and a message `process_message()` raised on, are both rejected with `requeue=False`. Putting such a message back would be asking for the same failure immediately and for ever; dropping it silently with an `ack` would lose it without saying so. Rejecting it hands the decision to the broker, which is the only place a dead letter exchange can be configured.
172
-
173
- Unlike the implementation this was drawn from, constructing a service does not start it. `start()` is called by whoever owns the worker, which is what makes a service testable without a broker.
174
-
175
- ## Integration in the Suite
176
-
177
- This package is part of the Wexample Suite — a collection of high-quality, modular tools designed to work seamlessly together across multiple languages and environments.
178
-
179
- ### Related Packages
180
-
181
- The suite includes packages for configuration management, file handling, prompts, and more. Each package can be used independently or as part of the integrated suite.
182
-
183
- ## Dependencies
184
-
185
- - pika: >=1.3.0
186
- - wexample-app: >=19.4.0
187
- - wexample-helpers: >=20.5.0
188
-
189
- ## Versioning & Compatibility Policy
190
-
191
- Wexample packages follow **Semantic Versioning** (SemVer):
192
-
193
- - **MAJOR**: Breaking changes
194
- - **MINOR**: New features, backward compatible
195
- - **PATCH**: Bug fixes, backward compatible
196
-
197
- We maintain backward compatibility within major versions and provide clear migration guides for breaking changes.
198
-
199
- ## License
200
-
201
- This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
202
-
203
- Free to use in both personal and commercial projects.
204
-
205
- ## About us
206
-
207
- [Wexample](https://wexample.com) stands as a cornerstone of the digital ecosystem — a collective of seasoned engineers, researchers, and creators driven by a relentless pursuit of technological excellence. More than a media platform, it has grown into a vibrant community where innovation meets craftsmanship, and where every line of code reflects a commitment to clarity, durability, and shared intelligence.
208
-
209
- This packages suite embodies this spirit. Trusted by professionals and enthusiasts alike, it delivers a consistent, high-quality foundation for modern development — open, elegant, and battle-tested. Its reputation is built on years of collaboration, refinement, and rigorous attention to detail, making it a natural choice for those who demand both robustness and beauty in their tools.
210
-
211
- Wexample cultivates a culture of mastery. Each package, each contribution carries the mark of a community that values precision, ethics, and innovation — a community proud to shape the future of digital craftsmanship.
212
-
213
- Built and maintained by [Romain Weeger](https://weeger.io).
214
-
215
- ## Known Limitations & Roadmap
216
-
217
- Current limitations and planned features are tracked in the GitHub issues.
218
-
219
- See the [project roadmap](https://github.com/wexample/python-queue/issues) for upcoming features and improvements.
220
-
221
- ## Status & Compatibility
222
-
223
- **Maturity**: Production-ready
224
-
225
- **Python Support**: >=3.10
226
-
227
- **OS Support**: Linux, macOS, Windows
228
-
229
- **Status**: Actively maintained
230
-
231
- ## Useful Links
232
-
233
- - **Homepage**: https://github.com/wexample/python-queue
234
- - **Issue Tracker**: https://github.com/wexample/python-queue/issues
235
- - **Discussions**: https://github.com/wexample/python-queue/discussions
236
- - **PyPI**: [pypi.org/project/wexample-queue](https://pypi.org/project/wexample-queue/)
237
-
238
- ## Migration Notes
239
-
240
- When upgrading between major versions, refer to the migration guides in the documentation.
241
-
242
- Breaking changes are clearly documented with upgrade paths and examples.