python-trio / trio-amqp Goto Github PK
View Code? Open in Web Editor NEWAsynchronous messaging for snake people
License: BSD 3-Clause "New" or "Revised" License
Asynchronous messaging for snake people
License: BSD 3-Clause "New" or "Revised" License
I'd like to ask what the current status of the trio-amqp
project is. Is this considered production ready and recommended for use? I notice it's a bit behind on merges from the aioamqp
project from which it was forked, but not having dug into it, that may be because it is now independent, and any needs that apply have been addressed.
I also notice that you have an anyio
-oriented AMQP implementation at https://github.com/M-o-a-T/asyncamqp, which is up to date with aioamqp
, but has not been published to PyPI (in fact, there's now a separate project published under the same name). Is that the library you would recommend for use in a trio
application currently?
Any related guidance you might be able to provide regarding a client library (for RabbitMQ specifically if that matters) in a trio-based app would be appreciated (even if these libraries aren't production-ready and the suggestion is to use an asyncio
lib via trio-asyncio
instead).
With current trio-amqp
(0.2.13), as well as current master, there are a couple of places the decorator @trio.hazmat.enable_ki_protection
causes this warning to be issued when used with recent trio
:
trio.TrioDeprecationWarning: trio.hazmat is deprecated since Trio 0.15.0; use trio.lowlevel instead (https://github.com/python-trio/trio/issues/476)
As you can see, the warning is related to module rename discussed at python-trio/trio#476.
reproduce: (just copied from examples/send.py)
env:
import anyio
import async_amqp
async def send():
async with async_amqp.connect_amqp() as protocol:
channel = await protocol.channel()
await channel.queue_declare(queue_name="hello")
await channel.basic_publish(
payload=b"Hello World!", exchange_name="", routing_key="hello"
)
print(" [x] Sent 'Hello World!'")
# anyio.run(send)
# i do run this script on trio
trio.run(send)
logs at the rabbitmq side:
rabbitmq | 2021-08-24 08:23:09.194281+00:00 [info] <0.2972.0> accepting AMQP connection <0.2972.0> (172.22.0.1:45794 -> 172.22.0.2:5672)
rabbitmq | 2021-08-24 08:23:09.196500+00:00 [info] <0.2972.0> connection <0.2972.0> (172.22.0.1:45794 -> 172.22.0.2:5672): user 'guest' authenticated and granted access to vhost '/'
rabbitmq | 2021-08-24 08:23:09.199222+00:00 [warn] <0.2972.0> closing AMQP connection <0.2972.0> (172.22.0.1:45794 -> 172.22.0.2:5672, vhost: '/', user: 'guest'):
rabbitmq | 2021-08-24 08:23:09.199222+00:00 [warn] <0.2972.0> client unexpectedly closed TCP connection
rabbitmq complains client unexpectedly closed TCP connection
.
as comparison, i tried pika, and here is rabbitmq's logs
rabbitmq | 2021-08-24 08:50:27.299260+00:00 [info] <0.3927.0> accepting AMQP connection <0.3927.0> (172.22.0.1:45828 -> 172.22.0.2:5672)
rabbitmq | 2021-08-24 08:50:27.302410+00:00 [info] <0.3927.0> connection <0.3927.0> (172.22.0.1:45828 -> 172.22.0.2:5672): user 'guest' authenticated and granted access to vhost '/'
rabbitmq | 2021-08-24 08:50:27.310122+00:00 [info] <0.3927.0> closing AMQP connection <0.3927.0> (172.22.0.1:45828 -> 172.22.0.2:5672, vhost: '/', user: 'guest')
I understand amqp1-0-0 is quite different with 0-9-1, but since the former is the formal release, are you considering supporting it?
Traceback (most recent call last):
File "worker.py", line 2, in <module>
import trio_amqp
File "/usr/lib/python3.5/site-packages/trio_amqp/__init__.py", line 45
yield amqp
^
I see that the default branch is set to master
, but it seems like most of the new development is being merged to main
, as well as PyPI releases being made from main
.
It seems like main
is being used as the main branch for development, not master
, so it's confusing when visiting this repo and getting master
by default.
Would it be possible to change the default branch to main
?
I notice that there hasn't been a new release in over a year and that version 0.2.13 gives an error because it's using the deprecated trio.Queue. Perhaps a new release is a good idea so it doesn't turn off new users?
There have been a number of deprecations/removals in trio since trio-amqp
was last updated:
open_cancel_scope()
deprecatedEvent.clear()
deprecatedtrio.hazmat
renamed to trio.lowlevel
(also as #11)I will submit a PR shortly to address these changes.
There are also some existing similar updates in master
(at least the removal of trio.Queue
) that have yet to be released. As a result, the current release of trio-amqp
is currently only compatible with trio<=0.8.0
(0.17.0 is current). Please make a new release as soon as possible. There's been no movement on releasing https://github.com/M-o-a-T/asyncamqp as mentioned in #8, and it sounds like you intend to instead merge that back into trio-amqp
as discussed in #9, but the situation right now is that there is no working, released AMQP client library for recent versions of trio.
Traceback (most recent call last):
File "/home/laura/dev/discord/umbelli/umbelli/launcher.py", line 47, in <module>
sys.exit(main())
File "/home/laura/dev/discord/umbelli/umbelli/launcher.py", line 33, in main
trio.run(run_master_node, config_file)
File "/home/laura/.local/share/virtualenvs/umbelli-SAq8Y3LW/lib/python3.6/site-packages/trio/_core/_run.py", line 1225, in run
return result.unwrap()
File "/home/laura/.local/share/virtualenvs/umbelli-SAq8Y3LW/lib/python3.6/site-packages/trio/_core/_result.py", line 119, in unwrap
raise self.error
File "/home/laura/.local/share/virtualenvs/umbelli-SAq8Y3LW/lib/python3.6/site-packages/trio/_core/_run.py", line 1334, in run_impl
msg = task.coro.send(next_send)
File "/home/laura/.local/share/virtualenvs/umbelli-SAq8Y3LW/lib/python3.6/site-packages/trio/_core/_run.py", line 923, in init
self.entry_queue.spawn()
File "/home/laura/.local/share/virtualenvs/umbelli-SAq8Y3LW/lib/python3.6/site-packages/trio/_util.py", line 109, in __aexit__
await self._agen.asend(None)
File "/home/laura/.local/share/virtualenvs/umbelli-SAq8Y3LW/lib/python3.6/site-packages/async_generator/_impl.py", line 274, in asend
return await self._do_it(self._it.send, value)
File "/home/laura/.local/share/virtualenvs/umbelli-SAq8Y3LW/lib/python3.6/site-packages/async_generator/_impl.py", line 290, in _do_it
return await ANextIter(self._it, start_fn, *args)
File "/home/laura/.local/share/virtualenvs/umbelli-SAq8Y3LW/lib/python3.6/site-packages/async_generator/_impl.py", line 202, in send
return self._invoke(self._it.send, value)
File "/home/laura/.local/share/virtualenvs/umbelli-SAq8Y3LW/lib/python3.6/site-packages/async_generator/_impl.py", line 209, in _invoke
result = fn(*args)
File "/home/laura/.local/share/virtualenvs/umbelli-SAq8Y3LW/lib/python3.6/site-packages/trio/_core/_run.py", line 318, in open_nursery
await nursery._nested_child_finished(nested_child_exc)
File "/usr/lib64/python3.6/contextlib.py", line 99, in __exit__
self.gen.throw(type, value, traceback)
File "/home/laura/.local/share/virtualenvs/umbelli-SAq8Y3LW/lib/python3.6/site-packages/trio/_core/_run.py", line 203, in open_cancel_scope
yield scope
File "/home/laura/.local/share/virtualenvs/umbelli-SAq8Y3LW/lib/python3.6/site-packages/trio/_core/_multierror.py", line 144, in __exit__
raise filtered_exc
File "/home/laura/.local/share/virtualenvs/umbelli-SAq8Y3LW/lib/python3.6/site-packages/trio/_core/_run.py", line 203, in open_cancel_scope
yield scope
File "/home/laura/.local/share/virtualenvs/umbelli-SAq8Y3LW/lib/python3.6/site-packages/trio/_core/_run.py", line 318, in open_nursery
await nursery._nested_child_finished(nested_child_exc)
File "/home/laura/.local/share/virtualenvs/umbelli-SAq8Y3LW/lib/python3.6/site-packages/trio/_core/_run.py", line 427, in _nested_child_finished
raise MultiError(self._pending_excs)
File "/home/laura/.local/share/virtualenvs/umbelli-SAq8Y3LW/lib/python3.6/site-packages/trio/_core/_run.py", line 1334, in run_impl
msg = task.coro.send(next_send)
File "/home/laura/dev/discord/umbelli/umbelli/master/__init__.py", line 46, in run_master_node
await node._closed.wait()
File "/home/laura/.local/share/virtualenvs/umbelli-SAq8Y3LW/lib/python3.6/site-packages/async_generator/_util.py", line 42, in __aexit__
await self._agen.asend(None)
File "/home/laura/dev/discord/umbelli/umbelli/master/__init__.py", line 32, in open_master_node
await node.close()
File "/home/laura/.local/share/virtualenvs/umbelli-SAq8Y3LW/lib/python3.6/site-packages/async_generator/_util.py", line 42, in __aexit__
await self._agen.asend(None)
File "/home/laura/.local/share/virtualenvs/umbelli-SAq8Y3LW/lib/python3.6/site-packages/trio_amqp/__init__.py", line 45, in connect_from_url
yield amqp
File "/home/laura/.local/share/virtualenvs/umbelli-SAq8Y3LW/lib/python3.6/site-packages/async_generator/_util.py", line 42, in __aexit__
await self._agen.asend(None)
File "/home/laura/.local/share/virtualenvs/umbelli-SAq8Y3LW/lib/python3.6/site-packages/trio_amqp/protocol.py", line 641, in connect_amqp
amqp._cancel_all()
File "/home/laura/.local/share/virtualenvs/umbelli-SAq8Y3LW/lib/python3.6/site-packages/trio/_util.py", line 109, in __aexit__
await self._agen.asend(None)
File "/home/laura/.local/share/virtualenvs/umbelli-SAq8Y3LW/lib/python3.6/site-packages/async_generator/_impl.py", line 274, in asend
return await self._do_it(self._it.send, value)
File "/home/laura/.local/share/virtualenvs/umbelli-SAq8Y3LW/lib/python3.6/site-packages/async_generator/_impl.py", line 290, in _do_it
return await ANextIter(self._it, start_fn, *args)
File "/home/laura/.local/share/virtualenvs/umbelli-SAq8Y3LW/lib/python3.6/site-packages/async_generator/_impl.py", line 202, in send
return self._invoke(self._it.send, value)
File "/home/laura/.local/share/virtualenvs/umbelli-SAq8Y3LW/lib/python3.6/site-packages/async_generator/_impl.py", line 209, in _invoke
result = fn(*args)
File "/home/laura/.local/share/virtualenvs/umbelli-SAq8Y3LW/lib/python3.6/site-packages/trio/_core/_run.py", line 318, in open_nursery
await nursery._nested_child_finished(nested_child_exc)
File "/usr/lib64/python3.6/contextlib.py", line 99, in __exit__
self.gen.throw(type, value, traceback)
File "/home/laura/.local/share/virtualenvs/umbelli-SAq8Y3LW/lib/python3.6/site-packages/trio/_core/_run.py", line 203, in open_cancel_scope
yield scope
File "/home/laura/.local/share/virtualenvs/umbelli-SAq8Y3LW/lib/python3.6/site-packages/trio/_core/_multierror.py", line 144, in __exit__
raise filtered_exc
File "/home/laura/.local/share/virtualenvs/umbelli-SAq8Y3LW/lib/python3.6/site-packages/trio/_core/_run.py", line 203, in open_cancel_scope
yield scope
File "/home/laura/.local/share/virtualenvs/umbelli-SAq8Y3LW/lib/python3.6/site-packages/trio/_core/_run.py", line 318, in open_nursery
await nursery._nested_child_finished(nested_child_exc)
File "/home/laura/.local/share/virtualenvs/umbelli-SAq8Y3LW/lib/python3.6/site-packages/trio/_core/_run.py", line 427, in _nested_child_finished
raise MultiError(self._pending_excs)
File "/home/laura/.local/share/virtualenvs/umbelli-SAq8Y3LW/lib/python3.6/site-packages/trio/_core/_run.py", line 1334, in run_impl
msg = task.coro.send(next_send)
File "/home/laura/.local/share/virtualenvs/umbelli-SAq8Y3LW/lib/python3.6/site-packages/trio_amqp/protocol.py", line 482, in _reader_loop
frame = await self.get_frame()
File "/home/laura/.local/share/virtualenvs/umbelli-SAq8Y3LW/lib/python3.6/site-packages/trio_amqp/protocol.py", line 395, in get_frame
await frame.read_frame()
File "/home/laura/.local/share/virtualenvs/umbelli-SAq8Y3LW/lib/python3.6/site-packages/trio_amqp/frame.py", line 464, in read_frame
data = await self._readexactly(7)
File "/home/laura/.local/share/virtualenvs/umbelli-SAq8Y3LW/lib/python3.6/site-packages/trio_amqp/frame.py", line 453, in _readexactly
d = await self.reader.receive_some(length - len(data))
File "/home/laura/.local/share/virtualenvs/umbelli-SAq8Y3LW/lib/python3.6/site-packages/trio/_highlevel_socket.py", line 140, in receive_some
return await self.socket.recv(max_bytes)
File "/usr/lib64/python3.6/contextlib.py", line 99, in __exit__
self.gen.throw(type, value, traceback)
File "/home/laura/.local/share/virtualenvs/umbelli-SAq8Y3LW/lib/python3.6/site-packages/trio/_highlevel_socket.py", line 31, in _translate_socket_errors_to_stream_errors
raise ClosedStreamError("this socket was already closed") from None
trio.ClosedStreamError: this socket was already closed
Getting a lot of this spam; presumably it's obscuring an actual error.
hi, thanks for the awesome lib. althrough i just found some typos.
according to the latest code, the signature of callback is body, envelope, properties
, channel
has been removed.
and the docstring of basic_consume() says callback is coroutine, which actually is async func.
async def callback():
pass
type(callback) # func
type(callback()) # coroutine
There is a mismatch between the code published in this GitHub project and on PyPI.
trio_amqp
.async-amqp
a single version 0.5.0 released on 2021-06-07 is available. The code of that version differs significantly from the current master dd805fc, which is the same as tag 0.4.1.A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.