Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
95 changes: 38 additions & 57 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,39 +12,26 @@ jobs:
pylama:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Setup python3.10
uses: actions/setup-python@v2
with:
python-version: "3.10"
- name: Cache virtualenv
id: venv-cache
uses: actions/cache@v3
with:
path: .venv
key: venv-${{ runner.os }}-${{ github.job }}-${{ github.ref }}
- run: python -m pip install poetry
- run: poetry install
- run: poetry run pylama
- uses: actions/checkout@v5

- name: Install uv
uses: astral-sh/setup-uv@v6

- run: uv run ruff check
env:
FORCE_COLOR: 1
mypy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Setup python3.10
uses: actions/setup-python@v2
with:
python-version: "3.10"
- name: Cache virtualenv
id: venv-cache
uses: actions/cache@v3
with:
path: .venv
key: venv-${{ runner.os }}-${{ github.job }}-${{ github.ref }}
- run: python -m pip install poetry
- run: poetry install
- run: poetry run mypy
- uses: actions/checkout@v5

- name: Install uv
uses: astral-sh/setup-uv@v6

- name: Set up Python
run: uv python install

- run: uv run mypy
env:
FORCE_COLOR: 1
docs:
Expand All @@ -56,20 +43,15 @@ jobs:
- 5672:5672
- 5671:5671
steps:
- uses: actions/checkout@v2
- name: Setup python3.10
uses: actions/setup-python@v2
with:
python-version: "3.10"
- name: Cache virtualenv
id: venv-cache
uses: actions/cache@v3
with:
path: .venv
key: venv-${{ runner.os }}-${{ github.job }}-${{ github.ref }}
- run: python -m pip install poetry
- run: poetry install
- run: poetry run pytest -svv README.rst
- uses: actions/checkout@v5

- name: Install uv
uses: astral-sh/setup-uv@v6

- name: Set up Python
run: uv python install

- run: uv run pytest -svv README.rst
env:
FORCE_COLOR: 1

Expand All @@ -93,23 +75,22 @@ jobs:
- '3.12'
- '3.13'
- '3.14'
env:
UV_PYTHON: ${{ matrix.python }}
steps:
- uses: actions/checkout@v2
- name: Setup python${{ matrix.python }}
uses: actions/setup-python@v2
with:
python-version: "${{ matrix.python }}"
- name: Cache virtualenv
id: venv-cache
uses: actions/cache@v3
with:
path: .venv
key: venv-${{ runner.os }}-${{ github.job }}-${{ github.ref }}-${{ matrix.python }}
- run: python -m pip install poetry
- run: poetry install --with=uvloop
- uses: actions/checkout@v5

- name: Install uv
uses: astral-sh/setup-uv@v6

- name: Set up Python
run: uv python install

- run: uv sync --all-extras

- name: pytest
run: >-
poetry run pytest \
uv run pytest \
-vv \
--cov=aiormq \
--cov-report=term-missing \
Expand All @@ -118,7 +99,7 @@ jobs:
tests
env:
FORCE_COLOR: 1
- run: poetry run coveralls
- run: uv run coveralls
env:
COVERALLS_PARALLEL: 'true'
COVERALLS_SERVICE_NAME: github
Expand Down
23 changes: 10 additions & 13 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -148,23 +148,20 @@ Simple publisher
body = b'Hello World!'

# Perform connection
connection = await aiormq.connect("amqp://guest:guest@localhost//")
async with aiormq.connect("amqp://guest:guest@localhost//") as connection:
# Creating a channel
channel = await connection.channel()

# Creating a channel
channel = await connection.channel()
declare_ok = await channel.queue_declare("hello", auto_delete=True)

declare_ok = await channel.queue_declare("hello", auto_delete=True)

# Sending the message
await channel.basic_publish(body, routing_key='hello')
print(f" [x] Sent {body}")
# Sending the message
await channel.basic_publish(body, routing_key='hello')
print(f" [x] Sent {body}")

MESSAGE = await channel.basic_get(declare_ok.queue)
print(f" [x] Received message from {declare_ok.queue!r}")
MESSAGE = await channel.basic_get(declare_ok.queue)
print(f" [x] Received message from {declare_ok.queue!r}")


loop = asyncio.get_event_loop()
loop.run_until_complete(main())
asyncio.run(main())

assert MESSAGE is not None
assert MESSAGE.routing_key == "hello"
Expand Down
47 changes: 34 additions & 13 deletions aiormq/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,43 @@
from . import abc
from .channel import Channel
from .connection import (
Connection, connect, SSLContextProvider, TransportFactory,
Connection,
SSLContextProvider,
TransportFactory,
connect,
)
from .exceptions import (
AMQPChannelError, AMQPConnectionError, AMQPError, AMQPException,
AuthenticationError, ChannelAccessRefused, ChannelClosed,
ChannelInvalidStateError, ChannelLockedResource, ChannelNotFoundEntity,
ChannelPreconditionFailed, ConnectionChannelError, ConnectionClosed,
ConnectionCommandInvalid, ConnectionFrameError, ConnectionInternalError,
ConnectionNotAllowed, ConnectionNotImplemented, ConnectionResourceError,
ConnectionSyntaxError, ConnectionUnexpectedFrame, DeliveryError,
DuplicateConsumerTag, IncompatibleProtocolError, InvalidFrameError,
MethodNotImplemented, ProbableAuthenticationError, ProtocolSyntaxError,
AMQPChannelError,
AMQPConnectionError,
AMQPError,
AMQPException,
AuthenticationError,
ChannelAccessRefused,
ChannelClosed,
ChannelInvalidStateError,
ChannelLockedResource,
ChannelNotFoundEntity,
ChannelPreconditionFailed,
ConnectionChannelError,
ConnectionClosed,
ConnectionCommandInvalid,
ConnectionFrameError,
ConnectionInternalError,
ConnectionNotAllowed,
ConnectionNotImplemented,
ConnectionResourceError,
ConnectionSyntaxError,
ConnectionUnexpectedFrame,
DeliveryError,
DuplicateConsumerTag,
IncompatibleProtocolError,
InvalidFrameError,
MethodNotImplemented,
ProbableAuthenticationError,
ProtocolSyntaxError,
PublishError,
)


__all__ = (
"AMQPChannelError",
"AMQPConnectionError",
Expand All @@ -36,8 +57,6 @@
"ConnectionChannelError",
"ConnectionClosed",
"ConnectionCommandInvalid",
"SSLContextProvider",
"TransportFactory",
"ConnectionFrameError",
"ConnectionInternalError",
"ConnectionNotAllowed",
Expand All @@ -53,6 +72,8 @@
"ProbableAuthenticationError",
"ProtocolSyntaxError",
"PublishError",
"SSLContextProvider",
"TransportFactory",
"abc",
"connect",
"spec",
Expand Down
Loading