Code Monkey home page Code Monkey logo

trio-amqp's People

Contributors

andrewbunday avatar armata avatar cedricco avatar dave-shawley avatar dbaty avatar dimabxsx avatar dzen avatar fbochu avatar foolswood avatar fullylegit avatar hozn avatar kalaspuff avatar lburg avatar lexdene avatar mardiros avatar megadiablo avatar michael-k avatar mikmatko avatar mmariani avatar mwfrojdman avatar nhumrich avatar notmeta avatar os avatar pwistrand avatar rbarrois avatar remicardona avatar skewty avatar smurfix avatar sorcio avatar vmarkovtsev avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

trio-amqp's Issues

Project status

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).

trio.TrioDeprecationWarning: trio.hazmat is deprecated; use trio.lowlevel

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.

AmqpProtocol did not close connection properly

reproduce: (just copied from examples/send.py)

env:

  • rabbitmq 3.9.4
  • trio 0.19
  • python 3.9.6
  • async_amqp 0.5.0
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')

Any plan to support amqp1-0-0?

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?

SyntaxError: 'yield' inside async function

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
           ^

Default branch

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?

New release for pip install?

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?

Updates needed for recent trio versions (0.17.0 current as of this writing)

There have been a number of deprecations/removals in trio since trio-amqp was last updated:

  • open_cancel_scope() deprecated
  • Event.clear() deprecated
  • Python 3.5 support removed
  • trio.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.

This socket was already closed

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.

the signature of callbacks for channel.basic_consume() in examples/ are outdated

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

PyPI/GitHub mismatch (missing code for release 0.5.0)

There is a mismatch between the code published in this GitHub project and on PyPI.

  • Source distributions are available on PyPI up until version 0.2.13 released on 2018-09-04 under the PyPI project trio_amqp.
  • The tag 0.4.1 published on 2021-01-03 doesn't seem to be available anywhere on PyPI.
  • Under a new PyPI project name 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.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.