altdesktop / python-dbus-next

🚌 The next great DBus library for Python with asyncio support
https://python-dbus-next.readthedocs.io/en/latest/
MIT License
197 stars 59 forks source link

AnyIO implementation of BaseMessagebus #8

Open thedrow opened 5 years ago

thedrow commented 5 years ago

It'd be useful for those who use trio instead of asyncio if this library supported both. AnyIO is a library which provides an abstraction over different event loop implementations. Would you accept a patch that uses it instead of plain asyncio?

acrisci commented 5 years ago

I'm interested in hearing more about what would be required for this.

thedrow commented 5 years ago

Well we'd need to rewrite your socket code to use AnyIO. You just have to specify which backend you want to use. See the documentation for details.

acrisci commented 5 years ago

Oh ok I don't know that sounds like a lot changes. Let me make an alternative suggestion.

I've designed the library to be extended like this the best I could. Instead of doing that rewrite, you should be able to make your own BaseMessageBus implementation using that backend. This is basically just the message bus without any socket stuff.

That abstraction isn't perfect and there's a lot of opportunity to improve it to make it easier to use.

I would accept a new implementation of BaseMessageBus for AnyIO into the project.

nicola-lunghi commented 4 years ago

If I can give my 2 cent... asyncio is in the standard library anyio is not...