amqp-client-python 0.1.14__tar.gz → 0.2.0.post1__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.
- amqp_client_python-0.2.0.post1/.env.example +22 -0
- amqp_client_python-0.2.0.post1/.flake8 +6 -0
- amqp_client_python-0.2.0.post1/.github/workflows/lint.yml +33 -0
- amqp_client_python-0.2.0.post1/.github/workflows/publish.yml +24 -0
- amqp_client_python-0.2.0.post1/.github/workflows/test.yml +64 -0
- amqp_client_python-0.2.0.post1/.github/workflows/type.yml +19 -0
- amqp_client_python-0.2.0.post1/.gitignore +7 -0
- amqp_client_python-0.2.0.post1/.pre-commit-config.yaml +20 -0
- amqp_client_python-0.2.0.post1/.readthedocs.yaml +33 -0
- amqp_client_python-0.2.0.post1/.vscode/settings.json +6 -0
- amqp_client_python-0.2.0.post1/CODE_OF_CONDUCT.md +22 -0
- {amqp_client_python-0.1.14 → amqp_client_python-0.2.0.post1}/PKG-INFO +101 -64
- {amqp_client_python-0.1.14 → amqp_client_python-0.2.0.post1}/README.md +78 -53
- {amqp_client_python-0.1.14 → amqp_client_python-0.2.0.post1}/amqp_client_python/domain/models/config.py +25 -2
- amqp_client_python-0.2.0.post1/amqp_client_python/domain/models/options.py +59 -0
- amqp_client_python-0.2.0.post1/amqp_client_python/domain/models/ssl_options.py +18 -0
- {amqp_client_python-0.1.14 → amqp_client_python-0.2.0.post1}/amqp_client_python/domain/utils/__init__.py +1 -0
- amqp_client_python-0.2.0.post1/amqp_client_python/domain/utils/types.py +7 -0
- {amqp_client_python-0.1.14 → amqp_client_python-0.2.0.post1}/amqp_client_python/exceptions/auto_reconnect_exception.py +2 -2
- {amqp_client_python-0.1.14 → amqp_client_python-0.2.0.post1}/amqp_client_python/exceptions/blocking_exception.py +3 -3
- amqp_client_python-0.2.0.post1/amqp_client_python/exceptions/eventbus_exception.py +7 -0
- {amqp_client_python-0.1.14 → amqp_client_python-0.2.0.post1}/amqp_client_python/exceptions/nack_exception.py +2 -2
- {amqp_client_python-0.1.14 → amqp_client_python-0.2.0.post1}/amqp_client_python/exceptions/publish_timeout_exception.py +2 -2
- {amqp_client_python-0.1.14 → amqp_client_python-0.2.0.post1}/amqp_client_python/exceptions/response_timeout_exception.py +2 -2
- {amqp_client_python-0.1.14 → amqp_client_python-0.2.0.post1}/amqp_client_python/exceptions/rpc_provider_exception.py +3 -3
- {amqp_client_python-0.1.14 → amqp_client_python-0.2.0.post1}/amqp_client_python/exceptions/thread_unsafe_exception.py +3 -3
- {amqp_client_python-0.1.14 → amqp_client_python-0.2.0.post1}/amqp_client_python/exceptions/timeout_exception.py +2 -2
- amqp_client_python-0.2.0.post1/amqp_client_python/py.typed +0 -0
- {amqp_client_python-0.1.14 → amqp_client_python-0.2.0.post1}/amqp_client_python/rabbitmq/async_channel.py +173 -115
- amqp_client_python-0.2.0.post1/amqp_client_python/rabbitmq/async_channel_factory.py +11 -0
- amqp_client_python-0.2.0.post1/amqp_client_python/rabbitmq/async_connection.py +476 -0
- {amqp_client_python-0.1.14 → amqp_client_python-0.2.0.post1}/amqp_client_python/rabbitmq/async_connection_factory.py +4 -3
- amqp_client_python-0.2.0.post1/amqp_client_python/rabbitmq/async_eventbus_rabbitmq.py +332 -0
- {amqp_client_python-0.1.14 → amqp_client_python-0.2.0.post1}/amqp_client_python/rabbitmq/channel_factory_rabbitmq.py +3 -1
- {amqp_client_python-0.1.14 → amqp_client_python-0.2.0.post1}/amqp_client_python/rabbitmq/channel_rabbitmq.py +54 -39
- {amqp_client_python-0.1.14 → amqp_client_python-0.2.0.post1}/amqp_client_python/rabbitmq/connection_factory_rabbitmq.py +4 -3
- {amqp_client_python-0.1.14 → amqp_client_python-0.2.0.post1}/amqp_client_python/rabbitmq/connection_rabbitmq.py +17 -15
- {amqp_client_python-0.1.14 → amqp_client_python-0.2.0.post1}/amqp_client_python/rabbitmq/eventbus_rabbitmq.py +26 -12
- {amqp_client_python-0.1.14 → amqp_client_python-0.2.0.post1}/amqp_client_python/rabbitmq/eventbus_wrapper_rabbitmq.py +42 -27
- {amqp_client_python-0.1.14 → amqp_client_python-0.2.0.post1}/amqp_client_python/rabbitmq/ioloop_factory.py +3 -2
- {amqp_client_python-0.1.14 → amqp_client_python-0.2.0.post1}/amqp_client_python/signals.py +9 -8
- amqp_client_python-0.2.0.post1/create-self-signed-certs.sh +173 -0
- amqp_client_python-0.2.0.post1/dev_requirements.txt +63 -0
- amqp_client_python-0.2.0.post1/docker-compose.yml +24 -0
- amqp_client_python-0.2.0.post1/docs/API/domain/config.md +1 -0
- amqp_client_python-0.2.0.post1/docs/API/domain/options.md +1 -0
- amqp_client_python-0.2.0.post1/docs/API/domain/ssl_options.md +1 -0
- amqp_client_python-0.2.0.post1/docs/API/rabbitmq/async_eventbus.md +1 -0
- amqp_client_python-0.2.0.post1/docs/contribute.md +40 -0
- amqp_client_python-0.2.0.post1/docs/index.md +26 -0
- amqp_client_python-0.2.0.post1/docs/stylesheets/extra.css +35 -0
- amqp_client_python-0.2.0.post1/docs/templates/cards.html +20 -0
- amqp_client_python-0.2.0.post1/docs/templates/installation.md +9 -0
- amqp_client_python-0.2.0.post1/docs/templates/sponsors.md +5 -0
- amqp_client_python-0.2.0.post1/docs/templates/user_guide.md +8 -0
- amqp_client_python-0.2.0.post1/docs/tutorial.md +72 -0
- amqp_client_python-0.2.0.post1/examples/__init__.py +0 -0
- amqp_client_python-0.2.0.post1/examples/async_case.py +67 -0
- amqp_client_python-0.2.0.post1/examples/default.py +8 -0
- amqp_client_python-0.2.0.post1/examples/multprocess.py +73 -0
- amqp_client_python-0.2.0.post1/examples/publish.py +10 -0
- amqp_client_python-0.2.0.post1/examples/rpc_publish.py +15 -0
- amqp_client_python-0.2.0.post1/examples/rpc_subscribe.py +17 -0
- amqp_client_python-0.2.0.post1/examples/sanic_test.py +36 -0
- amqp_client_python-0.2.0.post1/examples/ssl_connection.py +28 -0
- amqp_client_python-0.2.0.post1/examples/subscribe.py +15 -0
- amqp_client_python-0.2.0.post1/examples/sync_case.py +52 -0
- amqp_client_python-0.2.0.post1/examples/sync_wrapper_case.py +50 -0
- amqp_client_python-0.2.0.post1/examples/thread.py +59 -0
- amqp_client_python-0.2.0.post1/external_config/rabbitmq/rabbitmq.conf +1003 -0
- amqp_client_python-0.2.0.post1/mkdocs.yml +34 -0
- amqp_client_python-0.2.0.post1/mypy.ini +2 -0
- amqp_client_python-0.2.0.post1/pyproject.toml +79 -0
- amqp_client_python-0.2.0.post1/tests/__init__.py +0 -0
- amqp_client_python-0.2.0.post1/tests/integration/__init__.py +0 -0
- amqp_client_python-0.2.0.post1/tests/integration/async_eventbus/__init__.py +0 -0
- amqp_client_python-0.2.0.post1/tests/integration/async_eventbus/conftest.py +31 -0
- amqp_client_python-0.2.0.post1/tests/integration/async_eventbus/rpc_provider_test.py +54 -0
- amqp_client_python-0.2.0.post1/tests/integration/async_eventbus/signals_test.py +62 -0
- amqp_client_python-0.2.0.post1/tests/integration/async_eventbus/ssl_test.py +23 -0
- amqp_client_python-0.2.0.post1/tests/integration/async_eventbus/subscribe_test.py +26 -0
- amqp_client_python-0.2.0.post1/tests/integration/async_eventbus_wrapper/__init__.py +0 -0
- amqp_client_python-0.2.0.post1/tests/integration/async_eventbus_wrapper/conftest.py +32 -0
- amqp_client_python-0.2.0.post1/tests/integration/async_eventbus_wrapper/rpc_provider_test.py +21 -0
- amqp_client_python-0.2.0.post1/tests/integration/async_eventbus_wrapper/signals_test.py +65 -0
- amqp_client_python-0.2.0.post1/tests/integration/async_eventbus_wrapper/ssl_test.py +23 -0
- amqp_client_python-0.2.0.post1/tests/integration/async_eventbus_wrapper/subscribe_test.py +22 -0
- amqp_client_python-0.2.0.post1/tests/integration/eventbus/__init__.py +0 -0
- amqp_client_python-0.2.0.post1/tests/integration/eventbus/conftest.py +12 -0
- amqp_client_python-0.2.0.post1/tests/integration/eventbus/publish_test.py +0 -0
- amqp_client_python-0.2.0.post1/tests/integration/eventbus/rpc_publish_test.py +0 -0
- amqp_client_python-0.2.0.post1/tests/integration/eventbus/rpc_subscribe_test.py +0 -0
- amqp_client_python-0.2.0.post1/tests/integration/eventbus/subscribe_test.py +0 -0
- amqp_client_python-0.2.0.post1/tests/unit/__init__.py +0 -0
- amqp_client_python-0.2.0.post1/tests/unit/channels/test_async_channel.py +122 -0
- amqp_client_python-0.2.0.post1/tests/unit/channels/test_async_rpc_client.py +134 -0
- amqp_client_python-0.2.0.post1/tests/unit/channels/test_channel_factory.py +21 -0
- amqp_client_python-0.2.0.post1/tests/unit/channels/test_publish.py +73 -0
- amqp_client_python-0.2.0.post1/tests/unit/channels/test_rpc_subscribe.py +76 -0
- amqp_client_python-0.2.0.post1/tests/unit/channels/test_subscribe.py +30 -0
- amqp_client_python-0.2.0.post1/tests/unit/config/test_uri.py +37 -0
- amqp_client_python-0.2.0.post1/tests/unit/conftest.py +39 -0
- amqp_client_python-0.2.0.post1/tests/unit/eventbus/default.py +2 -0
- amqp_client_python-0.2.0.post1/tests/unit/eventbus/test_async_eventbus.py +31 -0
- amqp_client_python-0.2.0.post1/tests/unit/eventbus/test_async_eventbus_provide_resource.py +57 -0
- amqp_client_python-0.2.0.post1/tests/unit/eventbus/test_async_eventbus_publish.py +78 -0
- amqp_client_python-0.2.0.post1/tests/unit/eventbus/test_async_eventbus_rpc_client.py +62 -0
- amqp_client_python-0.2.0.post1/tests/unit/eventbus/test_async_eventbus_subscribe.py +38 -0
- amqp_client_python-0.2.0.post1/tests/unit/utils/ca.pem +20 -0
- amqp_client_python-0.2.0.post1/tests/unit/utils/rabbitmq_cert.pem +19 -0
- amqp_client_python-0.2.0.post1/tests/unit/utils/rabbitmq_key.pem +27 -0
- amqp_client_python-0.2.0.post1/uv.lock +1624 -0
- amqp_client_python-0.1.14/amqp_client_python/domain/models/options.py +0 -31
- amqp_client_python-0.1.14/amqp_client_python/domain/models/ssl_options.py +0 -7
- amqp_client_python-0.1.14/amqp_client_python/exceptions/eventbus_exception.py +0 -7
- amqp_client_python-0.1.14/amqp_client_python/rabbitmq/async_channel_factory.py +0 -6
- amqp_client_python-0.1.14/amqp_client_python/rabbitmq/async_connection.py +0 -271
- amqp_client_python-0.1.14/amqp_client_python/rabbitmq/async_eventbus_rabbitmq.py +0 -161
- amqp_client_python-0.1.14/pyproject.toml +0 -37
- {amqp_client_python-0.1.14 → amqp_client_python-0.2.0.post1}/LICENSE +0 -0
- {amqp_client_python-0.1.14 → amqp_client_python-0.2.0.post1}/amqp_client_python/__init__.py +0 -0
- {amqp_client_python-0.1.14 → amqp_client_python-0.2.0.post1}/amqp_client_python/domain/models/__init__.py +0 -0
- {amqp_client_python-0.1.14 → amqp_client_python-0.2.0.post1}/amqp_client_python/domain/utils/connection_type.py +0 -0
- {amqp_client_python-0.1.14 → amqp_client_python-0.2.0.post1}/amqp_client_python/event/__init__.py +0 -0
- {amqp_client_python-0.1.14 → amqp_client_python-0.2.0.post1}/amqp_client_python/event/async_provider_handler.py +0 -0
- {amqp_client_python-0.1.14 → amqp_client_python-0.2.0.post1}/amqp_client_python/event/async_subscriber_handler.py +0 -0
- {amqp_client_python-0.1.14 → amqp_client_python-0.2.0.post1}/amqp_client_python/event/event.py +0 -0
- {amqp_client_python-0.1.14 → amqp_client_python-0.2.0.post1}/amqp_client_python/event/integration_event.py +0 -0
- {amqp_client_python-0.1.14 → amqp_client_python-0.2.0.post1}/amqp_client_python/event/integration_event_handler.py +0 -0
- {amqp_client_python-0.1.14 → amqp_client_python-0.2.0.post1}/amqp_client_python/event/provider_handler.py +0 -0
- {amqp_client_python-0.1.14 → amqp_client_python-0.2.0.post1}/amqp_client_python/event/subscriber_handler.py +0 -0
- {amqp_client_python-0.1.14 → amqp_client_python-0.2.0.post1}/amqp_client_python/exceptions/__init__.py +0 -0
- {amqp_client_python-0.1.14 → amqp_client_python-0.2.0.post1}/amqp_client_python/rabbitmq/__init__.py +0 -0
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
RABBITMQ_SSL=FALSE
|
|
2
|
+
|
|
3
|
+
# RABBITMQ_CERT_PATH: RabbitMQ Certificate
|
|
4
|
+
# default value: .certs/analytics/cert.pem
|
|
5
|
+
#
|
|
6
|
+
# To generate self-signed certificates,
|
|
7
|
+
# use the ./create-self-signed-certs.sh script.
|
|
8
|
+
RABBITMQ_CERT_PATH=.certs/analytics/rabbitmq_cert.pem
|
|
9
|
+
|
|
10
|
+
# RABBITMQ_KEY_PATH: RabbitMQ Key
|
|
11
|
+
# default value: .certs/analytics/key.pem
|
|
12
|
+
#
|
|
13
|
+
# To generate self-signed certificates,
|
|
14
|
+
# use the ./create-self-signed-certs.sh script.
|
|
15
|
+
RABBITMQ_KEY_PATH=.certs/analytics/rabbitmq_key.pem
|
|
16
|
+
|
|
17
|
+
# RABBITMQ_CA_PATH: RabbitMQ Certificate of the Authentication entity (CA)
|
|
18
|
+
# default value: .certs/analytics/ca.pem
|
|
19
|
+
#
|
|
20
|
+
# To generate self-signed certificates,
|
|
21
|
+
# use the ./create-self-signed-certs.sh script.
|
|
22
|
+
RABBITMQ_CA_PATH=.certs/analytics/ca.pem
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
# This workflow will install Python dependencies, run tests and lint with a single version of Python
|
|
2
|
+
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions
|
|
3
|
+
|
|
4
|
+
name: Lint
|
|
5
|
+
|
|
6
|
+
on:
|
|
7
|
+
push:
|
|
8
|
+
branches: [ "master", "develop" ]
|
|
9
|
+
pull_request:
|
|
10
|
+
branches: [ "master", "develop" ]
|
|
11
|
+
|
|
12
|
+
permissions:
|
|
13
|
+
contents: read
|
|
14
|
+
|
|
15
|
+
jobs:
|
|
16
|
+
build:
|
|
17
|
+
|
|
18
|
+
runs-on: ubuntu-latest
|
|
19
|
+
|
|
20
|
+
steps:
|
|
21
|
+
- uses: actions/checkout@v3
|
|
22
|
+
- name: Set up Python 3.8
|
|
23
|
+
uses: actions/setup-python@v3
|
|
24
|
+
with:
|
|
25
|
+
python-version: "3.8"
|
|
26
|
+
- name: Install dependencies
|
|
27
|
+
run: |
|
|
28
|
+
python -m pip install --upgrade pip
|
|
29
|
+
pip install flake8
|
|
30
|
+
- name: Lint with flake8
|
|
31
|
+
run: |
|
|
32
|
+
# stop the build if there are Python syntax errors or undefined names
|
|
33
|
+
flake8 amqp_client_python/ --ignore=E722,W503,E402 --count --max-line-length=127 --statistics
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
name: Publish to PyPI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
release:
|
|
5
|
+
types: [created]
|
|
6
|
+
|
|
7
|
+
jobs:
|
|
8
|
+
deploy:
|
|
9
|
+
runs-on: ubuntu-latest
|
|
10
|
+
steps:
|
|
11
|
+
- uses: actions/checkout@v3
|
|
12
|
+
- name: Set up Python
|
|
13
|
+
uses: actions/setup-python@v4
|
|
14
|
+
with:
|
|
15
|
+
python-version: '3.x'
|
|
16
|
+
- name: Install Poetry
|
|
17
|
+
uses: snok/install-poetry@v1
|
|
18
|
+
- name: Build and publish
|
|
19
|
+
env:
|
|
20
|
+
PYPI_TOKEN: ${{ secrets.PYPI_TOKEN }}
|
|
21
|
+
run: |
|
|
22
|
+
poetry config pypi-token.pypi $PYPI_TOKEN
|
|
23
|
+
poetry build
|
|
24
|
+
poetry publish
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
# This workflow will install Python dependencies, run tests and lint with a single version of Python
|
|
2
|
+
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions
|
|
3
|
+
|
|
4
|
+
name: Tests
|
|
5
|
+
|
|
6
|
+
on:
|
|
7
|
+
push:
|
|
8
|
+
branches: [ "master", "develop" ]
|
|
9
|
+
pull_request:
|
|
10
|
+
branches: [ "master", "develop" ]
|
|
11
|
+
|
|
12
|
+
permissions:
|
|
13
|
+
contents: read
|
|
14
|
+
|
|
15
|
+
jobs:
|
|
16
|
+
build:
|
|
17
|
+
runs-on: ubuntu-latest
|
|
18
|
+
|
|
19
|
+
steps:
|
|
20
|
+
- name: Checkout repository
|
|
21
|
+
uses: actions/checkout@v3
|
|
22
|
+
- name: Generate self-signed certificates
|
|
23
|
+
run: |
|
|
24
|
+
# Make the script executable and run it
|
|
25
|
+
chmod +x ./create-self-signed-certs.sh
|
|
26
|
+
./create-self-signed-certs.sh
|
|
27
|
+
|
|
28
|
+
- name: Start RabbitMQ container manually
|
|
29
|
+
run: |
|
|
30
|
+
# We start the container manually as a step to ensure that the certificate
|
|
31
|
+
# and config files exist on the host before we try to mount them.
|
|
32
|
+
docker run -d --name rabbitmq \
|
|
33
|
+
-p 5672:5672 \
|
|
34
|
+
-p 5671:5671 \
|
|
35
|
+
-v ${{ github.workspace }}/.certs/rabbitmq:/etc/ssl:ro \
|
|
36
|
+
-v ${{ github.workspace }}/external_config/rabbitmq/rabbitmq.conf:/etc/rabbitmq/rabbitmq.conf:ro \
|
|
37
|
+
-e RABBITMQ_DEFAULT_USER=guest \
|
|
38
|
+
-e RABBITMQ_DEFAULT_PASS=guest \
|
|
39
|
+
rabbitmq:3-management-alpine
|
|
40
|
+
- name: Wait for RabbitMQ to start
|
|
41
|
+
run: |
|
|
42
|
+
echo "Waiting for RabbitMQ to initialize..."
|
|
43
|
+
# Give the container time to start up and apply the configuration.
|
|
44
|
+
sleep 8
|
|
45
|
+
- name: Set up Python 3.8
|
|
46
|
+
uses: actions/setup-python@v3
|
|
47
|
+
with:
|
|
48
|
+
python-version: "3.8"
|
|
49
|
+
- name: Install dependencies
|
|
50
|
+
run: |
|
|
51
|
+
python -m pip install --upgrade pip
|
|
52
|
+
pip install pytest pika coverage
|
|
53
|
+
if [ -f dev_requirements.txt ]; then pip install -r dev_requirements.txt; fi
|
|
54
|
+
- name: Run unit tests with coverage
|
|
55
|
+
run: |
|
|
56
|
+
coverage run --source=amqp_client_python -m pytest -v tests/unit/
|
|
57
|
+
- name: Run integration tests with coverage
|
|
58
|
+
run: |
|
|
59
|
+
coverage run --append --source=amqp_client_python -m pytest -v tests/integration/
|
|
60
|
+
env:
|
|
61
|
+
AMQP_DOMAIN: localhost
|
|
62
|
+
- name: Generate and show combined coverage report
|
|
63
|
+
run: |
|
|
64
|
+
coverage report --show-missing
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
name: Python Type Checking
|
|
2
|
+
|
|
3
|
+
on: [push, pull_request]
|
|
4
|
+
|
|
5
|
+
jobs:
|
|
6
|
+
mypy:
|
|
7
|
+
runs-on: ubuntu-latest
|
|
8
|
+
steps:
|
|
9
|
+
- uses: actions/checkout@v2
|
|
10
|
+
- name: Set up Python
|
|
11
|
+
uses: actions/setup-python@v2
|
|
12
|
+
with:
|
|
13
|
+
python-version: '3.x'
|
|
14
|
+
- name: Install dependencies
|
|
15
|
+
run: |
|
|
16
|
+
python -m pip install --upgrade pip
|
|
17
|
+
pip install mypy
|
|
18
|
+
- name: Run mypy
|
|
19
|
+
run: mypy amqp_client_python/
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
repos:
|
|
2
|
+
- repo: https://github.com/ambv/black
|
|
3
|
+
rev: 23.1.0
|
|
4
|
+
hooks:
|
|
5
|
+
- id: black
|
|
6
|
+
language_version: python3.8
|
|
7
|
+
stages: [commit]
|
|
8
|
+
- repo: https://github.com/PyCQA/flake8
|
|
9
|
+
rev: 6.0.0
|
|
10
|
+
hooks:
|
|
11
|
+
- id: flake8
|
|
12
|
+
stages: [commit]
|
|
13
|
+
- repo: local
|
|
14
|
+
hooks:
|
|
15
|
+
- id: requirements
|
|
16
|
+
name: requirements
|
|
17
|
+
entry: bash -c 'dev_env/bin/pip3 freeze > dev_requirements.txt; git add dev_requirements.txt'
|
|
18
|
+
language: system
|
|
19
|
+
pass_filenames: false
|
|
20
|
+
stages: [commit]
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
version: 2
|
|
2
|
+
|
|
3
|
+
# Set the OS, Python version and other tools you might need
|
|
4
|
+
build:
|
|
5
|
+
os: ubuntu-22.04
|
|
6
|
+
tools:
|
|
7
|
+
python: "3.8"
|
|
8
|
+
jobs:
|
|
9
|
+
post_create_environment:
|
|
10
|
+
- pip install poetry
|
|
11
|
+
- poetry config virtualenvs.create false
|
|
12
|
+
post_install:
|
|
13
|
+
- pip install --only doc
|
|
14
|
+
# You can also specify other tool versions:
|
|
15
|
+
# nodejs: "19"
|
|
16
|
+
# rust: "1.64"
|
|
17
|
+
# golang: "1.19"
|
|
18
|
+
|
|
19
|
+
# Build documentation in the "docs/" directory with Sphinx
|
|
20
|
+
mkdocs:
|
|
21
|
+
configuration: mkdocs.yml
|
|
22
|
+
|
|
23
|
+
# Optionally build your docs in additional formats such as PDF and ePub
|
|
24
|
+
# formats:
|
|
25
|
+
# - pdf
|
|
26
|
+
# - epub
|
|
27
|
+
|
|
28
|
+
# Optional but recommended, declare the Python requirements required
|
|
29
|
+
# to build your documentation
|
|
30
|
+
# See https://docs.readthedocs.io/en/stable/guides/reproducible-builds.html
|
|
31
|
+
# python:
|
|
32
|
+
# install:
|
|
33
|
+
# - requirements: docs/requirements.txt
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
# Contributor Code of Conduct
|
|
2
|
+
|
|
3
|
+
As contributors and maintainers of this project, and in the interest of fostering an open and welcoming community, we pledge to respect all people who contribute through reporting issues, posting feature requests, updating documentation, submitting pull requests or patches, and other activities.
|
|
4
|
+
|
|
5
|
+
We are committed to making participation in this project a harassment-free experience for everyone, regardless of level of experience, gender identity, sexual orientation, disability, personal appearance, race, ethnicity, age, religion, or nationality.
|
|
6
|
+
|
|
7
|
+
Examples of unacceptable behavior include:
|
|
8
|
+
|
|
9
|
+
* The use of sexualized language or imagery
|
|
10
|
+
* Personal attacks
|
|
11
|
+
* Trolling or insulting/derogatory comments
|
|
12
|
+
* Public or private harassment
|
|
13
|
+
* Publishing others' private information, such as physical or electronic addresses, without explicit permission
|
|
14
|
+
* Other unethical or unprofessional conduct
|
|
15
|
+
|
|
16
|
+
## Enforcement
|
|
17
|
+
|
|
18
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project team at our [discord channel](https://discord.gg/RkXNeZpNZk). All complaints will be reviewed and investigated and will result in a response that is deemed necessary and appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident.
|
|
19
|
+
|
|
20
|
+
## Attribution
|
|
21
|
+
|
|
22
|
+
This Code of Conduct is adapted from the Contributor Covenant, version 2.1, available at https://www.contributor-covenant.org/version/2/1/code_of_conduct.html
|
|
@@ -1,27 +1,44 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
2
|
Name: amqp-client-python
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.2.0.post1
|
|
4
4
|
Summary: Python AMQP Client Library
|
|
5
|
-
|
|
5
|
+
Project-URL: Homepage, https://github.com/nutes-uepb/amqp-client-python
|
|
6
|
+
Project-URL: Repository, https://github.com/nutes-uepb/amqp-client-python
|
|
7
|
+
Project-URL: Bug Tracker, https://github.com/nutes-uepb/amqp-client-python/issues
|
|
8
|
+
Project-URL: Source, https://github.com/nutes-uepb/amqp-client-python
|
|
9
|
+
Author-email: NUTES UEPB <dev.seniorsaudemovel@gmail.com>
|
|
10
|
+
Maintainer-email: "João Pedro Miranda C. Hluchan" <berrytern@gmail.com>
|
|
6
11
|
License: Apache-2.0
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
12
|
+
License-File: LICENSE
|
|
13
|
+
Keywords: amqp-client-python,dependency,packaging
|
|
14
|
+
Classifier: Development Status :: 5 - Production/Stable
|
|
15
|
+
Classifier: Intended Audience :: Developers
|
|
11
16
|
Classifier: License :: OSI Approved :: Apache Software License
|
|
17
|
+
Classifier: Natural Language :: English
|
|
18
|
+
Classifier: Operating System :: OS Independent
|
|
12
19
|
Classifier: Programming Language :: Python :: 3
|
|
13
|
-
Classifier: Programming Language :: Python :: 3.7
|
|
14
20
|
Classifier: Programming Language :: Python :: 3.8
|
|
15
21
|
Classifier: Programming Language :: Python :: 3.9
|
|
16
22
|
Classifier: Programming Language :: Python :: 3.10
|
|
17
23
|
Classifier: Programming Language :: Python :: 3.11
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
24
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
25
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
26
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
27
|
+
Classifier: Topic :: Communications
|
|
28
|
+
Classifier: Topic :: Internet
|
|
29
|
+
Classifier: Topic :: Software Development :: Libraries
|
|
30
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
31
|
+
Classifier: Topic :: System :: Networking
|
|
32
|
+
Requires-Python: <4.0,>=3.9
|
|
33
|
+
Requires-Dist: pika<2.0.0,>=1.3.0
|
|
21
34
|
Description-Content-Type: text/markdown
|
|
22
35
|
|
|
23
36
|
# AMQP Client Python
|
|
24
37
|
|
|
38
|
+
A Python client providing a high-level abstraction for interacting with RabbitMQ, simplifying message publishing, subscribing, and RPC patterns.
|
|
39
|
+
|
|
40
|
+
--------
|
|
41
|
+
|
|
25
42
|
[![License][license-image]][license-url]
|
|
26
43
|
<a href="https://pypi.org/project/amqp-client-python" target="_blank">
|
|
27
44
|
<img src="https://img.shields.io/pypi/v/amqp-client-python?color=%2334D058&label=pypi%20package" alt="Package version">
|
|
@@ -33,10 +50,25 @@ Description-Content-Type: text/markdown
|
|
|
33
50
|
|
|
34
51
|
|
|
35
52
|
|
|
53
|
+
---
|
|
36
54
|
|
|
37
|
-
|
|
38
|
-
|
|
55
|
+
**Documentation**: <a href="https://nutes-uepb.github.io/amqp-client-python" target="_blank">https://nutes-uepb.github.io/amqp-client-python</a>
|
|
56
|
+
|
|
57
|
+
**Source Code**: <a href="https://github.com/nutes-uepb/amqp-client-python" target="_blank">https://github.com/nutes-uepb/amqp-client-python</a>
|
|
39
58
|
|
|
59
|
+
**Discord Server**: <a href="https://discord.gg/RkXNeZpNZk" target="_blank">https://discord.gg/RkXNeZpNZk</a>
|
|
60
|
+
|
|
61
|
+
### 🦀 Looking for higher performance? Try `amqp-rs`!
|
|
62
|
+
If you need higher throughput, thread safety, and built-in compression, check out [**amqp-rs**](https://pypi.org/project/amqp-rs/).
|
|
63
|
+
|
|
64
|
+
It is a high-performance Python extension developed in Rust using PyO3 and `tokio`. It shares a similar API and design philosophy with this library, but adds native thread safety, `zstd`/`zlib`/`lz4` compression, robust TLS/SSL support, and graceful shutdowns.
|
|
65
|
+
|
|
66
|
+
You can install it via `pip` or `uv`:
|
|
67
|
+
```bash
|
|
68
|
+
pip install amqp-rs
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
---
|
|
40
72
|
### Features:
|
|
41
73
|
- Automatic creation and management of queues, exchanges and channels;
|
|
42
74
|
- Connection persistence and auto reconnect;
|
|
@@ -46,19 +78,23 @@ Client with high level of abstraction for manipulation of messages in the event
|
|
|
46
78
|
- Support for a Remote procedure call _(RPC)_.
|
|
47
79
|
|
|
48
80
|
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
81
|
+
### Table of Compatibility
|
|
82
|
+
| version | compatible with |
|
|
83
|
+
| ---- | ---- |
|
|
84
|
+
| 0.2.0 | 0.2.0 |
|
|
85
|
+
| 0.1.14 | ~0.1.12 |
|
|
86
|
+
|
|
87
|
+
### Installation
|
|
88
|
+
|
|
89
|
+
You can install `amqp-client-python` using pip:
|
|
90
|
+
```bash
|
|
91
|
+
pip install amqp-client-python
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
### Prerequisites
|
|
95
|
+
|
|
96
|
+
* Python 3.7+
|
|
97
|
+
* A running RabbitMQ instance.
|
|
62
98
|
|
|
63
99
|
### Examples:
|
|
64
100
|
#### you can use [sync](https://github.com/nutes-uepb/amqp-client-python/blob/develop/amqp_client_python/rabbitmq/eventbus_rabbitmq.py) , [async eventbus](https://github.com/nutes-uepb/amqp-client-python/blob/develop/amqp_client_python/rabbitmq/async_eventbus_rabbitmq.py) and [sync wrapper](https://github.com/nutes-uepb/amqp-client-python/blob/develop/amqp_client_python/rabbitmq/eventbus_wrapper_rabbitmq.py) of async eventbus
|
|
@@ -72,34 +108,26 @@ from amqp_client_python import (
|
|
|
72
108
|
AsyncEventbusRabbitMQ,
|
|
73
109
|
Config, Options
|
|
74
110
|
)
|
|
75
|
-
from amqp_client_python.event import IntegrationEvent, IntegrationEventHandler
|
|
76
111
|
config = Config(Options("queue", "rpc_queue", "rpc_exchange"))
|
|
77
112
|
eventbus = AsyncEventbusRabbitMQ(config)
|
|
78
113
|
# publish
|
|
79
|
-
class ExampleEvent(IntegrationEvent):
|
|
80
|
-
EVENT_NAME: str = "ExampleEvent"
|
|
81
|
-
def __init__(self, event_type: str, message = []) -> None:
|
|
82
|
-
super().__init__(self.EVENT_NAME, event_type)
|
|
83
|
-
self.message = message
|
|
84
114
|
|
|
85
|
-
|
|
86
|
-
eventbus.publish(publish_event, rpc_routing_key, "direct")
|
|
115
|
+
eventbus.publish("rpc_exchange", "routing.key", "message_content")
|
|
87
116
|
# subscribe
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
await eventbus.subscribe(subscribe_event, subscribe_event_handle, rpc_routing_key)
|
|
117
|
+
async def subscribe_handler(body) -> None:
|
|
118
|
+
print(body, type(body), flush=True) # handle messages
|
|
119
|
+
await eventbus.subscribe("rpc_exchange", "routing.key", subscribe_handler)
|
|
92
120
|
# rpc_publish
|
|
93
|
-
response = await eventbus.rpc_client(rpc_exchange, "user.find",
|
|
121
|
+
response = await eventbus.rpc_client("rpc_exchange", "user.find", "message_content")
|
|
94
122
|
# provider
|
|
95
|
-
async def
|
|
123
|
+
async def rpc_provider_handler(body) -> bytes:
|
|
96
124
|
print(f"body: {body}")
|
|
97
125
|
return b"content"
|
|
98
|
-
await eventbus.provide_resource("user.find",
|
|
126
|
+
await eventbus.provide_resource("user.find", rpc_provider_handler)
|
|
99
127
|
```
|
|
100
128
|
</details>
|
|
101
129
|
|
|
102
|
-
<details><summary>sync usage</summary>
|
|
130
|
+
<details><summary>sync usage(deprecated)</summary>
|
|
103
131
|
|
|
104
132
|
```Python
|
|
105
133
|
from amqp_client_python import (
|
|
@@ -153,7 +181,7 @@ while running:
|
|
|
153
181
|
count += 1
|
|
154
182
|
if str(count) != eventbus.rpc_client(rpc_exchange, rpc_routing_key+"2", [f"{count}"]).decode("utf-8"):
|
|
155
183
|
running = False
|
|
156
|
-
#eventbus.publish(publish_event, rpc_routing_key, "
|
|
184
|
+
#eventbus.publish(publish_event, rpc_routing_key, "message_content")
|
|
157
185
|
#running = False
|
|
158
186
|
except TimeoutError as err:
|
|
159
187
|
print("timeout!!!: ", str(err))
|
|
@@ -168,40 +196,30 @@ while running:
|
|
|
168
196
|
|
|
169
197
|
```Python
|
|
170
198
|
from amqp_client_python import EventbusWrapperRabbitMQ, Config, Options
|
|
171
|
-
from amqp_client_python.event import IntegrationEvent, IntegrationEventHandler
|
|
172
199
|
|
|
173
|
-
config = Config(Options(queue, rpc_queue, rpc_exchange))
|
|
200
|
+
config = Config(Options("queue", "rpc_queue", "rpc_exchange"))
|
|
174
201
|
eventbus = EventbusWrapperRabbitMQ(config=config)
|
|
175
202
|
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
def __init__(self, event_type: str, message = []) -> None:
|
|
179
|
-
super().__init__(self.EVENT_NAME, event_type)
|
|
180
|
-
self.message = message
|
|
181
|
-
class ExampleEventHandler(IntegrationEventHandler):
|
|
182
|
-
async def handle(self, body) -> None:
|
|
183
|
-
print(body,"subscribe")
|
|
203
|
+
async def subscribe_handler(body) -> None:
|
|
204
|
+
print(f"{body}", type(body), flush=True)
|
|
184
205
|
|
|
185
|
-
async def
|
|
186
|
-
print(body
|
|
187
|
-
return f"{body
|
|
206
|
+
async def rpc_provider_handler(body) -> bytes:
|
|
207
|
+
print(f"handle - {body}", type(body), flush=True)
|
|
208
|
+
return f"{body}".encode("utf-8")
|
|
188
209
|
|
|
189
|
-
subscribe_event = ExampleEvent(rpc_exchange)
|
|
190
|
-
publish_event = ExampleEvent(rpc_exchange, ["message"])
|
|
191
|
-
subscribe_event_handle = ExampleEventHandler()
|
|
192
210
|
# rpc_provider
|
|
193
|
-
eventbus.provide_resource(
|
|
211
|
+
eventbus.provide_resource("user.find", rpc_provider_handler).result()
|
|
194
212
|
# subscribe
|
|
195
|
-
eventbus.subscribe(
|
|
213
|
+
eventbus.subscribe("rpc_exchange", "routing.key", subscribe_handler).result()
|
|
196
214
|
count = 0
|
|
197
215
|
running = True
|
|
198
216
|
while running:
|
|
199
217
|
try:
|
|
200
218
|
count += 1
|
|
201
219
|
# rpc_client call
|
|
202
|
-
eventbus.rpc_client(rpc_exchange,
|
|
220
|
+
eventbus.rpc_client("rpc_exchange", "user.find", count).result().decode("utf-8")
|
|
203
221
|
# publish
|
|
204
|
-
eventbus.publish(
|
|
222
|
+
eventbus.publish("rpc_exchange", "routing.key", "message_content").result()
|
|
205
223
|
#running = False
|
|
206
224
|
except KeyboardInterrupt:
|
|
207
225
|
running=False
|
|
@@ -211,12 +229,31 @@ while running:
|
|
|
211
229
|
</details>
|
|
212
230
|
<br />
|
|
213
231
|
|
|
232
|
+
|
|
233
|
+
## Sponsors
|
|
234
|
+
The library is provided by NUTES-UEPB.
|
|
235
|
+
<br/>
|
|
236
|
+
<a href="https://nutes.uepb.edu.br/" target="_blank"><img width="250px" src="https://nutes.uepb.edu.br/wp-content/uploads/2018/11/cropped-logo-Nutes-Final.jpg"></a>
|
|
237
|
+
|
|
214
238
|
### Know Limitations:
|
|
215
239
|
#### basic eventbus
|
|
216
240
|
<medium><pre>
|
|
217
|
-
When using [**EventbusRabbitMQ**](https://github.com/nutes-uepb/amqp-client-python/blob/master/amqp_client_python/rabbitmq/eventbus_rabbitmq.py#L12) Should not use rpc call inside of rpc provider
|
|
241
|
+
When using [**EventbusRabbitMQ**](https://github.com/nutes-uepb/amqp-client-python/blob/master/amqp_client_python/rabbitmq/eventbus_rabbitmq.py#L12) Should not use rpc call inside of rpc provider or subscribe handlers, it may block the ioloop
|
|
218
242
|
#/obs: fixed on other kinds of eventbus, will be removed on nexts releases
|
|
219
243
|
</pre></medium>
|
|
220
244
|
|
|
221
245
|
|
|
222
246
|
|
|
247
|
+
[//]: # (These are reference links used in the body of this note.)
|
|
248
|
+
[license-image]: https://img.shields.io/badge/license-Apache%202-blue.svg
|
|
249
|
+
[license-url]: https://github.com/nutes-uepb/amqp-client-python/blob/master/LICENSE
|
|
250
|
+
[npm-image]: https://img.shields.io/npm/v/amqp-client-python.svg?color=red&logo=npm
|
|
251
|
+
[npm-url]: https://npmjs.org/package/amqp-client-python
|
|
252
|
+
[downloads-image]: https://img.shields.io/npm/dt/amqp-client-python.svg?logo=npm
|
|
253
|
+
[travis-url]: https://travis-ci.org/nutes-uepb/amqp-client-python
|
|
254
|
+
[coverage-image]: https://coveralls.io/repos/github/nutes-uepb/amqp-client-python/badge.svg
|
|
255
|
+
[coverage-url]: https://coveralls.io/github/nutes-uepb/amqp-client-python?branch=master
|
|
256
|
+
[known-vulnerabilities-image]: https://snyk.io/test/github/nutes-uepb/amqp-client-python/badge.svg?targetFile=requirements.txt
|
|
257
|
+
[known-vulnerabilities-url]: https://snyk.io/test/github/nutes-uepb/amqp-client-python?targetFile=requirements.txt
|
|
258
|
+
[releases-image]: https://img.shields.io/github/release-date/nutes-uepb/amqp-client-python.svg
|
|
259
|
+
[releases-url]: https://github.com/nutes-uepb/amqp-client-python/releases
|