poly-bus-rabbitmq 0.4.2__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.
- poly_bus_rabbitmq-0.4.2/LICENSE +21 -0
- poly_bus_rabbitmq-0.4.2/PKG-INFO +266 -0
- poly_bus_rabbitmq-0.4.2/README.md +227 -0
- poly_bus_rabbitmq-0.4.2/pyproject.toml +123 -0
- poly_bus_rabbitmq-0.4.2/setup.cfg +4 -0
- poly_bus_rabbitmq-0.4.2/src/poly_bus_rabbitmq.egg-info/PKG-INFO +266 -0
- poly_bus_rabbitmq-0.4.2/src/poly_bus_rabbitmq.egg-info/SOURCES.txt +12 -0
- poly_bus_rabbitmq-0.4.2/src/poly_bus_rabbitmq.egg-info/dependency_links.txt +1 -0
- poly_bus_rabbitmq-0.4.2/src/poly_bus_rabbitmq.egg-info/requires.txt +14 -0
- poly_bus_rabbitmq-0.4.2/src/poly_bus_rabbitmq.egg-info/top_level.txt +1 -0
- poly_bus_rabbitmq-0.4.2/src/transport/__init__.py +1 -0
- poly_bus_rabbitmq-0.4.2/src/transport/rabbitmq/__init__.py +6 -0
- poly_bus_rabbitmq-0.4.2/src/transport/rabbitmq/rabbitmq_config.py +40 -0
- poly_bus_rabbitmq-0.4.2/src/transport/rabbitmq/rabbitmq_transport.py +487 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Poly Bus RabbitMQ Contributors
|
|
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,266 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: poly-bus-rabbitmq
|
|
3
|
+
Version: 0.4.2
|
|
4
|
+
Summary: The RabbitMQ transport for PolyBus.
|
|
5
|
+
Author-email: Cy Scott <cy.a.scott@live.com>
|
|
6
|
+
License: MIT
|
|
7
|
+
Project-URL: Homepage, https://github.com/CyAScott/ppoly-bus-transports-rabbitmq
|
|
8
|
+
Project-URL: Repository, https://github.com/CyAScott/poly-bus-transports-rabbitmq
|
|
9
|
+
Project-URL: Issues, https://github.com/CyAScott/poly-bus-transports-rabbitmq/issues
|
|
10
|
+
Keywords: messaging,message-bus,polyglot,microservices,distributed-systems,async
|
|
11
|
+
Classifier: Development Status :: 3 - Alpha
|
|
12
|
+
Classifier: Intended Audience :: Developers
|
|
13
|
+
Classifier: Operating System :: OS Independent
|
|
14
|
+
Classifier: Programming Language :: Python :: 3
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.8
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
20
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
21
|
+
Classifier: Typing :: Typed
|
|
22
|
+
Requires-Python: >=3.8
|
|
23
|
+
Description-Content-Type: text/markdown
|
|
24
|
+
License-File: LICENSE
|
|
25
|
+
Requires-Dist: pika>=1.3.0
|
|
26
|
+
Requires-Dist: httpx>=0.24.0
|
|
27
|
+
Requires-Dist: poly-bus>=0.3.10
|
|
28
|
+
Provides-Extra: dev
|
|
29
|
+
Requires-Dist: pytest>=7.0.0; extra == "dev"
|
|
30
|
+
Requires-Dist: pytest-cov>=4.0.0; extra == "dev"
|
|
31
|
+
Requires-Dist: pytest-asyncio>=0.21.0; extra == "dev"
|
|
32
|
+
Requires-Dist: pytest-timeout>=2.1.0; extra == "dev"
|
|
33
|
+
Requires-Dist: httpx>=0.24.0; extra == "dev"
|
|
34
|
+
Requires-Dist: black>=23.0.0; extra == "dev"
|
|
35
|
+
Requires-Dist: isort>=5.12.0; extra == "dev"
|
|
36
|
+
Requires-Dist: flake8>=6.0.0; extra == "dev"
|
|
37
|
+
Requires-Dist: mypy>=1.0.0; extra == "dev"
|
|
38
|
+
Dynamic: license-file
|
|
39
|
+
|
|
40
|
+
# PolyBus Python
|
|
41
|
+
|
|
42
|
+
A Python implementation of the PolyBus messaging library, providing a unified interface for message transport across different messaging systems.
|
|
43
|
+
|
|
44
|
+
## Prerequisites
|
|
45
|
+
|
|
46
|
+
- [Python 3.8+](https://www.python.org/downloads/) (supports Python 3.8-3.12)
|
|
47
|
+
- pip (Python package installer)
|
|
48
|
+
- Any IDE that supports Python development (VS Code, PyCharm, etc.)
|
|
49
|
+
|
|
50
|
+
## Quick Start
|
|
51
|
+
|
|
52
|
+
### Setting Up Development Environment
|
|
53
|
+
|
|
54
|
+
```bash
|
|
55
|
+
# Navigate to the python directory
|
|
56
|
+
cd src/python
|
|
57
|
+
|
|
58
|
+
# Create a virtual environment (recommended)
|
|
59
|
+
python3 -m venv venv
|
|
60
|
+
source .venv/bin/activate # On Windows: venv\Scripts\activate
|
|
61
|
+
|
|
62
|
+
# Install the package in development mode with dev dependencies
|
|
63
|
+
./dev.sh install
|
|
64
|
+
# Or manually:
|
|
65
|
+
pip install -e ".[dev]"
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
### Building the Project
|
|
69
|
+
|
|
70
|
+
```bash
|
|
71
|
+
# Install dependencies and package
|
|
72
|
+
./dev.sh install
|
|
73
|
+
|
|
74
|
+
# Build the package
|
|
75
|
+
./dev.sh build
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
### Running Tests
|
|
79
|
+
|
|
80
|
+
```bash
|
|
81
|
+
# Run all tests
|
|
82
|
+
./dev.sh test
|
|
83
|
+
# Or: python -m pytest
|
|
84
|
+
|
|
85
|
+
# Run tests with coverage
|
|
86
|
+
./dev.sh test-cov
|
|
87
|
+
# Or: python -m pytest --cov=poly_bus --cov-report=html
|
|
88
|
+
|
|
89
|
+
# Run specific test files
|
|
90
|
+
python -m pytest tests/transport/rabbitmq/test_endpoint.py
|
|
91
|
+
|
|
92
|
+
# Run tests with verbose output
|
|
93
|
+
python -m pytest -v
|
|
94
|
+
|
|
95
|
+
# Run tests matching a pattern
|
|
96
|
+
python -m pytest -k "test_pattern"
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
## Development Workflow
|
|
100
|
+
|
|
101
|
+
### Code Quality and Linting
|
|
102
|
+
|
|
103
|
+
This project includes comprehensive code analysis and formatting tools:
|
|
104
|
+
|
|
105
|
+
```bash
|
|
106
|
+
# Run the complete development check suite
|
|
107
|
+
./dev.sh check
|
|
108
|
+
|
|
109
|
+
# Format code automatically
|
|
110
|
+
./dev.sh format
|
|
111
|
+
|
|
112
|
+
# Run linters only
|
|
113
|
+
./dev.sh lint
|
|
114
|
+
|
|
115
|
+
# Individual tools:
|
|
116
|
+
python -m black src tests # Code formatting
|
|
117
|
+
python -m isort src tests # Import sorting
|
|
118
|
+
python -m flake8 src tests # Style checking
|
|
119
|
+
python -m mypy src # Type checking
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
### IDE Integration
|
|
123
|
+
|
|
124
|
+
#### Visual Studio Code
|
|
125
|
+
1. Install the Python extension
|
|
126
|
+
2. Install Python development extensions (Black, isort, Flake8, mypy)
|
|
127
|
+
3. Open the `src/python` folder in VS Code
|
|
128
|
+
4. The project includes configuration for auto-formatting and linting
|
|
129
|
+
|
|
130
|
+
#### PyCharm
|
|
131
|
+
1. Open the `src/python` folder as a project
|
|
132
|
+
2. Configure the virtual environment as the project interpreter
|
|
133
|
+
3. Enable code inspections and formatting tools
|
|
134
|
+
|
|
135
|
+
## Configuration
|
|
136
|
+
|
|
137
|
+
### Project Configuration
|
|
138
|
+
|
|
139
|
+
The project uses `pyproject.toml` for modern Python packaging:
|
|
140
|
+
|
|
141
|
+
- **Python Version**: 3.8+ (supports 3.8-3.12)
|
|
142
|
+
- **Build System**: setuptools
|
|
143
|
+
- **Testing**: pytest with coverage
|
|
144
|
+
- **Code Quality**: black, isort, flake8, mypy
|
|
145
|
+
- **Package Structure**: src layout
|
|
146
|
+
|
|
147
|
+
### Code Style
|
|
148
|
+
|
|
149
|
+
Code style is enforced through:
|
|
150
|
+
- **Black** (88 character line length)
|
|
151
|
+
- **isort** (import sorting with black profile)
|
|
152
|
+
- **flake8** (PEP 8 compliance)
|
|
153
|
+
- **mypy** (type checking with strict settings)
|
|
154
|
+
|
|
155
|
+
### Testing Configuration
|
|
156
|
+
|
|
157
|
+
Pytest configuration includes:
|
|
158
|
+
- Coverage reporting (HTML, XML, terminal)
|
|
159
|
+
- Strict marker and config validation
|
|
160
|
+
- Support for async tests (pytest-asyncio)
|
|
161
|
+
- Test discovery patterns
|
|
162
|
+
|
|
163
|
+
## Dependencies
|
|
164
|
+
|
|
165
|
+
### Runtime Dependencies
|
|
166
|
+
- No runtime dependencies (pure Python implementation)
|
|
167
|
+
|
|
168
|
+
### Development Dependencies
|
|
169
|
+
- `pytest>=7.0.0` - Testing framework
|
|
170
|
+
- `pytest-cov>=4.0.0` - Coverage reporting
|
|
171
|
+
- `pytest-asyncio>=0.21.0` - Async test support
|
|
172
|
+
- `black>=23.0.0` - Code formatting
|
|
173
|
+
- `isort>=5.12.0` - Import sorting
|
|
174
|
+
- `flake8>=6.0.0` - Style checking
|
|
175
|
+
- `mypy>=1.0.0` - Type checking
|
|
176
|
+
|
|
177
|
+
## Common Commands
|
|
178
|
+
|
|
179
|
+
```bash
|
|
180
|
+
# Development script commands
|
|
181
|
+
./dev.sh install # Install in development mode
|
|
182
|
+
./dev.sh test # Run tests
|
|
183
|
+
./dev.sh test-cov # Run tests with coverage
|
|
184
|
+
./dev.sh lint # Run all linters
|
|
185
|
+
./dev.sh format # Format code
|
|
186
|
+
./dev.sh check # Run all checks (format + lint + test)
|
|
187
|
+
./dev.sh clean # Clean build artifacts
|
|
188
|
+
./dev.sh build # Build package
|
|
189
|
+
./dev.sh help # Show all available commands
|
|
190
|
+
|
|
191
|
+
# Direct pytest commands
|
|
192
|
+
python -m pytest # Run all tests
|
|
193
|
+
python -m pytest --cov-report=html # Generate HTML coverage report
|
|
194
|
+
python -m pytest tests/example.py # Run specific test file
|
|
195
|
+
python -m pytest -x # Stop on first failure
|
|
196
|
+
python -m pytest --lf # Run last failed tests only
|
|
197
|
+
|
|
198
|
+
# Package management
|
|
199
|
+
pip install -e ".[dev]" # Install in development mode
|
|
200
|
+
pip install -r requirements-dev.txt # Install dev dependencies only
|
|
201
|
+
python -m build # Build wheel and source distribution
|
|
202
|
+
```
|
|
203
|
+
|
|
204
|
+
## Troubleshooting
|
|
205
|
+
|
|
206
|
+
### Environment Issues
|
|
207
|
+
|
|
208
|
+
1. **Python Version**: Ensure Python 3.8+ is installed
|
|
209
|
+
```bash
|
|
210
|
+
python3 --version
|
|
211
|
+
```
|
|
212
|
+
|
|
213
|
+
2. **Virtual Environment**: Always use a virtual environment
|
|
214
|
+
```bash
|
|
215
|
+
python3 -m venv venv
|
|
216
|
+
source .venv/bin/activate
|
|
217
|
+
```
|
|
218
|
+
|
|
219
|
+
3. **Package Installation Issues**: Upgrade pip and setuptools
|
|
220
|
+
```bash
|
|
221
|
+
pip install --upgrade pip setuptools wheel
|
|
222
|
+
```
|
|
223
|
+
|
|
224
|
+
### Test Issues
|
|
225
|
+
|
|
226
|
+
1. **Import Errors**: Ensure package is installed in development mode
|
|
227
|
+
```bash
|
|
228
|
+
pip install -e ".[dev]"
|
|
229
|
+
```
|
|
230
|
+
|
|
231
|
+
2. **Coverage Issues**: Check that source paths are correct in `pyproject.toml`
|
|
232
|
+
|
|
233
|
+
3. **Type Checking Issues**: mypy configuration is strict; add type annotations as needed
|
|
234
|
+
|
|
235
|
+
### Code Quality Issues
|
|
236
|
+
|
|
237
|
+
1. **Formatting**: Run `./dev.sh format` to auto-fix most formatting issues
|
|
238
|
+
2. **Import Order**: isort will automatically fix import ordering
|
|
239
|
+
3. **Type Errors**: Add proper type annotations for mypy compliance
|
|
240
|
+
|
|
241
|
+
## Contributing
|
|
242
|
+
|
|
243
|
+
1. Follow the established code style (enforced by formatters and linters)
|
|
244
|
+
2. Run `./dev.sh check` before committing
|
|
245
|
+
3. Ensure all tests pass and maintain high coverage
|
|
246
|
+
4. Add tests for new functionality
|
|
247
|
+
5. Add type annotations for all new code
|
|
248
|
+
6. Update documentation as needed
|
|
249
|
+
|
|
250
|
+
## Coverage Reports
|
|
251
|
+
|
|
252
|
+
After running tests with coverage (`./dev.sh test-cov`):
|
|
253
|
+
- **Terminal**: Coverage summary displayed in terminal
|
|
254
|
+
- **HTML**: Detailed report available in `htmlcov/index.html`
|
|
255
|
+
- **XML**: Machine-readable report in `coverage.xml`
|
|
256
|
+
|
|
257
|
+
## Additional Resources
|
|
258
|
+
|
|
259
|
+
- [Python Packaging Guide](https://packaging.python.org/)
|
|
260
|
+
- [pytest Documentation](https://docs.pytest.org/)
|
|
261
|
+
- [Black Code Formatter](https://black.readthedocs.io/)
|
|
262
|
+
- [mypy Type Checking](https://mypy.readthedocs.io/)
|
|
263
|
+
|
|
264
|
+
## License
|
|
265
|
+
|
|
266
|
+
See the main project LICENSE file for licensing information.
|
|
@@ -0,0 +1,227 @@
|
|
|
1
|
+
# PolyBus Python
|
|
2
|
+
|
|
3
|
+
A Python implementation of the PolyBus messaging library, providing a unified interface for message transport across different messaging systems.
|
|
4
|
+
|
|
5
|
+
## Prerequisites
|
|
6
|
+
|
|
7
|
+
- [Python 3.8+](https://www.python.org/downloads/) (supports Python 3.8-3.12)
|
|
8
|
+
- pip (Python package installer)
|
|
9
|
+
- Any IDE that supports Python development (VS Code, PyCharm, etc.)
|
|
10
|
+
|
|
11
|
+
## Quick Start
|
|
12
|
+
|
|
13
|
+
### Setting Up Development Environment
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
# Navigate to the python directory
|
|
17
|
+
cd src/python
|
|
18
|
+
|
|
19
|
+
# Create a virtual environment (recommended)
|
|
20
|
+
python3 -m venv venv
|
|
21
|
+
source .venv/bin/activate # On Windows: venv\Scripts\activate
|
|
22
|
+
|
|
23
|
+
# Install the package in development mode with dev dependencies
|
|
24
|
+
./dev.sh install
|
|
25
|
+
# Or manually:
|
|
26
|
+
pip install -e ".[dev]"
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
### Building the Project
|
|
30
|
+
|
|
31
|
+
```bash
|
|
32
|
+
# Install dependencies and package
|
|
33
|
+
./dev.sh install
|
|
34
|
+
|
|
35
|
+
# Build the package
|
|
36
|
+
./dev.sh build
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
### Running Tests
|
|
40
|
+
|
|
41
|
+
```bash
|
|
42
|
+
# Run all tests
|
|
43
|
+
./dev.sh test
|
|
44
|
+
# Or: python -m pytest
|
|
45
|
+
|
|
46
|
+
# Run tests with coverage
|
|
47
|
+
./dev.sh test-cov
|
|
48
|
+
# Or: python -m pytest --cov=poly_bus --cov-report=html
|
|
49
|
+
|
|
50
|
+
# Run specific test files
|
|
51
|
+
python -m pytest tests/transport/rabbitmq/test_endpoint.py
|
|
52
|
+
|
|
53
|
+
# Run tests with verbose output
|
|
54
|
+
python -m pytest -v
|
|
55
|
+
|
|
56
|
+
# Run tests matching a pattern
|
|
57
|
+
python -m pytest -k "test_pattern"
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
## Development Workflow
|
|
61
|
+
|
|
62
|
+
### Code Quality and Linting
|
|
63
|
+
|
|
64
|
+
This project includes comprehensive code analysis and formatting tools:
|
|
65
|
+
|
|
66
|
+
```bash
|
|
67
|
+
# Run the complete development check suite
|
|
68
|
+
./dev.sh check
|
|
69
|
+
|
|
70
|
+
# Format code automatically
|
|
71
|
+
./dev.sh format
|
|
72
|
+
|
|
73
|
+
# Run linters only
|
|
74
|
+
./dev.sh lint
|
|
75
|
+
|
|
76
|
+
# Individual tools:
|
|
77
|
+
python -m black src tests # Code formatting
|
|
78
|
+
python -m isort src tests # Import sorting
|
|
79
|
+
python -m flake8 src tests # Style checking
|
|
80
|
+
python -m mypy src # Type checking
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
### IDE Integration
|
|
84
|
+
|
|
85
|
+
#### Visual Studio Code
|
|
86
|
+
1. Install the Python extension
|
|
87
|
+
2. Install Python development extensions (Black, isort, Flake8, mypy)
|
|
88
|
+
3. Open the `src/python` folder in VS Code
|
|
89
|
+
4. The project includes configuration for auto-formatting and linting
|
|
90
|
+
|
|
91
|
+
#### PyCharm
|
|
92
|
+
1. Open the `src/python` folder as a project
|
|
93
|
+
2. Configure the virtual environment as the project interpreter
|
|
94
|
+
3. Enable code inspections and formatting tools
|
|
95
|
+
|
|
96
|
+
## Configuration
|
|
97
|
+
|
|
98
|
+
### Project Configuration
|
|
99
|
+
|
|
100
|
+
The project uses `pyproject.toml` for modern Python packaging:
|
|
101
|
+
|
|
102
|
+
- **Python Version**: 3.8+ (supports 3.8-3.12)
|
|
103
|
+
- **Build System**: setuptools
|
|
104
|
+
- **Testing**: pytest with coverage
|
|
105
|
+
- **Code Quality**: black, isort, flake8, mypy
|
|
106
|
+
- **Package Structure**: src layout
|
|
107
|
+
|
|
108
|
+
### Code Style
|
|
109
|
+
|
|
110
|
+
Code style is enforced through:
|
|
111
|
+
- **Black** (88 character line length)
|
|
112
|
+
- **isort** (import sorting with black profile)
|
|
113
|
+
- **flake8** (PEP 8 compliance)
|
|
114
|
+
- **mypy** (type checking with strict settings)
|
|
115
|
+
|
|
116
|
+
### Testing Configuration
|
|
117
|
+
|
|
118
|
+
Pytest configuration includes:
|
|
119
|
+
- Coverage reporting (HTML, XML, terminal)
|
|
120
|
+
- Strict marker and config validation
|
|
121
|
+
- Support for async tests (pytest-asyncio)
|
|
122
|
+
- Test discovery patterns
|
|
123
|
+
|
|
124
|
+
## Dependencies
|
|
125
|
+
|
|
126
|
+
### Runtime Dependencies
|
|
127
|
+
- No runtime dependencies (pure Python implementation)
|
|
128
|
+
|
|
129
|
+
### Development Dependencies
|
|
130
|
+
- `pytest>=7.0.0` - Testing framework
|
|
131
|
+
- `pytest-cov>=4.0.0` - Coverage reporting
|
|
132
|
+
- `pytest-asyncio>=0.21.0` - Async test support
|
|
133
|
+
- `black>=23.0.0` - Code formatting
|
|
134
|
+
- `isort>=5.12.0` - Import sorting
|
|
135
|
+
- `flake8>=6.0.0` - Style checking
|
|
136
|
+
- `mypy>=1.0.0` - Type checking
|
|
137
|
+
|
|
138
|
+
## Common Commands
|
|
139
|
+
|
|
140
|
+
```bash
|
|
141
|
+
# Development script commands
|
|
142
|
+
./dev.sh install # Install in development mode
|
|
143
|
+
./dev.sh test # Run tests
|
|
144
|
+
./dev.sh test-cov # Run tests with coverage
|
|
145
|
+
./dev.sh lint # Run all linters
|
|
146
|
+
./dev.sh format # Format code
|
|
147
|
+
./dev.sh check # Run all checks (format + lint + test)
|
|
148
|
+
./dev.sh clean # Clean build artifacts
|
|
149
|
+
./dev.sh build # Build package
|
|
150
|
+
./dev.sh help # Show all available commands
|
|
151
|
+
|
|
152
|
+
# Direct pytest commands
|
|
153
|
+
python -m pytest # Run all tests
|
|
154
|
+
python -m pytest --cov-report=html # Generate HTML coverage report
|
|
155
|
+
python -m pytest tests/example.py # Run specific test file
|
|
156
|
+
python -m pytest -x # Stop on first failure
|
|
157
|
+
python -m pytest --lf # Run last failed tests only
|
|
158
|
+
|
|
159
|
+
# Package management
|
|
160
|
+
pip install -e ".[dev]" # Install in development mode
|
|
161
|
+
pip install -r requirements-dev.txt # Install dev dependencies only
|
|
162
|
+
python -m build # Build wheel and source distribution
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
## Troubleshooting
|
|
166
|
+
|
|
167
|
+
### Environment Issues
|
|
168
|
+
|
|
169
|
+
1. **Python Version**: Ensure Python 3.8+ is installed
|
|
170
|
+
```bash
|
|
171
|
+
python3 --version
|
|
172
|
+
```
|
|
173
|
+
|
|
174
|
+
2. **Virtual Environment**: Always use a virtual environment
|
|
175
|
+
```bash
|
|
176
|
+
python3 -m venv venv
|
|
177
|
+
source .venv/bin/activate
|
|
178
|
+
```
|
|
179
|
+
|
|
180
|
+
3. **Package Installation Issues**: Upgrade pip and setuptools
|
|
181
|
+
```bash
|
|
182
|
+
pip install --upgrade pip setuptools wheel
|
|
183
|
+
```
|
|
184
|
+
|
|
185
|
+
### Test Issues
|
|
186
|
+
|
|
187
|
+
1. **Import Errors**: Ensure package is installed in development mode
|
|
188
|
+
```bash
|
|
189
|
+
pip install -e ".[dev]"
|
|
190
|
+
```
|
|
191
|
+
|
|
192
|
+
2. **Coverage Issues**: Check that source paths are correct in `pyproject.toml`
|
|
193
|
+
|
|
194
|
+
3. **Type Checking Issues**: mypy configuration is strict; add type annotations as needed
|
|
195
|
+
|
|
196
|
+
### Code Quality Issues
|
|
197
|
+
|
|
198
|
+
1. **Formatting**: Run `./dev.sh format` to auto-fix most formatting issues
|
|
199
|
+
2. **Import Order**: isort will automatically fix import ordering
|
|
200
|
+
3. **Type Errors**: Add proper type annotations for mypy compliance
|
|
201
|
+
|
|
202
|
+
## Contributing
|
|
203
|
+
|
|
204
|
+
1. Follow the established code style (enforced by formatters and linters)
|
|
205
|
+
2. Run `./dev.sh check` before committing
|
|
206
|
+
3. Ensure all tests pass and maintain high coverage
|
|
207
|
+
4. Add tests for new functionality
|
|
208
|
+
5. Add type annotations for all new code
|
|
209
|
+
6. Update documentation as needed
|
|
210
|
+
|
|
211
|
+
## Coverage Reports
|
|
212
|
+
|
|
213
|
+
After running tests with coverage (`./dev.sh test-cov`):
|
|
214
|
+
- **Terminal**: Coverage summary displayed in terminal
|
|
215
|
+
- **HTML**: Detailed report available in `htmlcov/index.html`
|
|
216
|
+
- **XML**: Machine-readable report in `coverage.xml`
|
|
217
|
+
|
|
218
|
+
## Additional Resources
|
|
219
|
+
|
|
220
|
+
- [Python Packaging Guide](https://packaging.python.org/)
|
|
221
|
+
- [pytest Documentation](https://docs.pytest.org/)
|
|
222
|
+
- [Black Code Formatter](https://black.readthedocs.io/)
|
|
223
|
+
- [mypy Type Checking](https://mypy.readthedocs.io/)
|
|
224
|
+
|
|
225
|
+
## License
|
|
226
|
+
|
|
227
|
+
See the main project LICENSE file for licensing information.
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=61.0", "wheel"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "poly-bus-rabbitmq"
|
|
7
|
+
version = "0.4.2"
|
|
8
|
+
description = "The RabbitMQ transport for PolyBus."
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
license = {text = "MIT"}
|
|
11
|
+
authors = [
|
|
12
|
+
{ name = "Cy Scott", email = "cy.a.scott@live.com" }
|
|
13
|
+
]
|
|
14
|
+
keywords = ["messaging", "message-bus", "polyglot", "microservices", "distributed-systems", "async"]
|
|
15
|
+
classifiers = [
|
|
16
|
+
"Development Status :: 3 - Alpha",
|
|
17
|
+
"Intended Audience :: Developers",
|
|
18
|
+
"Operating System :: OS Independent",
|
|
19
|
+
"Programming Language :: Python :: 3",
|
|
20
|
+
"Programming Language :: Python :: 3.8",
|
|
21
|
+
"Programming Language :: Python :: 3.9",
|
|
22
|
+
"Programming Language :: Python :: 3.10",
|
|
23
|
+
"Programming Language :: Python :: 3.11",
|
|
24
|
+
"Programming Language :: Python :: 3.12",
|
|
25
|
+
"Topic :: Software Development :: Libraries :: Python Modules",
|
|
26
|
+
"Typing :: Typed",
|
|
27
|
+
]
|
|
28
|
+
requires-python = ">=3.8"
|
|
29
|
+
dependencies = [
|
|
30
|
+
"pika>=1.3.0",
|
|
31
|
+
"httpx>=0.24.0",
|
|
32
|
+
"poly-bus>=0.3.10",
|
|
33
|
+
]
|
|
34
|
+
|
|
35
|
+
[project.optional-dependencies]
|
|
36
|
+
dev = [
|
|
37
|
+
"pytest>=7.0.0",
|
|
38
|
+
"pytest-cov>=4.0.0",
|
|
39
|
+
"pytest-asyncio>=0.21.0",
|
|
40
|
+
"pytest-timeout>=2.1.0",
|
|
41
|
+
"httpx>=0.24.0",
|
|
42
|
+
"black>=23.0.0",
|
|
43
|
+
"isort>=5.12.0",
|
|
44
|
+
"flake8>=6.0.0",
|
|
45
|
+
"mypy>=1.0.0",
|
|
46
|
+
]
|
|
47
|
+
|
|
48
|
+
[project.urls]
|
|
49
|
+
Homepage = "https://github.com/CyAScott/ppoly-bus-transports-rabbitmq"
|
|
50
|
+
Repository = "https://github.com/CyAScott/poly-bus-transports-rabbitmq"
|
|
51
|
+
Issues = "https://github.com/CyAScott/poly-bus-transports-rabbitmq/issues"
|
|
52
|
+
|
|
53
|
+
[tool.setuptools.packages.find]
|
|
54
|
+
where = ["src"]
|
|
55
|
+
include = ["*"]
|
|
56
|
+
exclude = ["tests*"]
|
|
57
|
+
|
|
58
|
+
[tool.setuptools.package-dir]
|
|
59
|
+
"" = "src"
|
|
60
|
+
|
|
61
|
+
[tool.pytest.ini_options]
|
|
62
|
+
testpaths = ["tests"]
|
|
63
|
+
python_files = ["test_*.py", "*_test.py"]
|
|
64
|
+
python_classes = ["Test*"]
|
|
65
|
+
python_functions = ["test_*"]
|
|
66
|
+
asyncio_mode = "auto"
|
|
67
|
+
addopts = [
|
|
68
|
+
"--strict-markers",
|
|
69
|
+
"--strict-config",
|
|
70
|
+
"--cov=src",
|
|
71
|
+
"--cov-report=term-missing",
|
|
72
|
+
"--cov-report=html",
|
|
73
|
+
"--cov-report=xml",
|
|
74
|
+
]
|
|
75
|
+
markers = [
|
|
76
|
+
"asyncio: marks tests as async (pytest-asyncio)",
|
|
77
|
+
]
|
|
78
|
+
|
|
79
|
+
[tool.black]
|
|
80
|
+
line-length = 88
|
|
81
|
+
target-version = ["py38"]
|
|
82
|
+
|
|
83
|
+
[tool.isort]
|
|
84
|
+
profile = "black"
|
|
85
|
+
multi_line_output = 3
|
|
86
|
+
include_trailing_comma = true
|
|
87
|
+
force_grid_wrap = 0
|
|
88
|
+
use_parentheses = true
|
|
89
|
+
ensure_newline_before_comments = true
|
|
90
|
+
line_length = 88
|
|
91
|
+
|
|
92
|
+
[tool.mypy]
|
|
93
|
+
python_version = "3.8"
|
|
94
|
+
warn_return_any = true
|
|
95
|
+
warn_unused_configs = true
|
|
96
|
+
disallow_untyped_defs = true
|
|
97
|
+
disallow_incomplete_defs = true
|
|
98
|
+
check_untyped_defs = true
|
|
99
|
+
disallow_untyped_decorators = true
|
|
100
|
+
no_implicit_optional = true
|
|
101
|
+
warn_redundant_casts = true
|
|
102
|
+
warn_unused_ignores = true
|
|
103
|
+
warn_no_return = true
|
|
104
|
+
warn_unreachable = true
|
|
105
|
+
strict_equality = true
|
|
106
|
+
|
|
107
|
+
[tool.coverage.run]
|
|
108
|
+
source = ["src"]
|
|
109
|
+
omit = [
|
|
110
|
+
"*/tests/*",
|
|
111
|
+
"*/__pycache__/*",
|
|
112
|
+
"*/__init__.py", # Exclude __init__.py files (often empty)
|
|
113
|
+
]
|
|
114
|
+
|
|
115
|
+
[tool.coverage.report]
|
|
116
|
+
exclude_lines = [
|
|
117
|
+
"pragma: no cover",
|
|
118
|
+
"def __repr__",
|
|
119
|
+
"raise AssertionError",
|
|
120
|
+
"raise NotImplementedError",
|
|
121
|
+
"if __name__ == .__main__.:",
|
|
122
|
+
"if TYPE_CHECKING:",
|
|
123
|
+
]
|