2

I'm trying to implement a dbus service that will be then used in a Gtk-application.

There are two python modules (pydbus vs. dbus-python) claiming to do just that. I've been unable to find any pro and contra list of both implementations.

My short question is:

What is the recommended way to implement a dbusservice in Python3?

enaut
  • 431
  • 4
  • 15
  • Your question is opinion-based which makes it a non stackoverflow question. – M.Mavini Oct 16 '21 at 10:34
  • It might be yes, but it has a lot of views so is probably interesting to others and as far as I know there are most/all possible solutions in the answers and the answers helped me a lot in my decision-making. – enaut Mar 19 '22 at 18:56

2 Answers2

2

pydbus is better because dbus-python was deprecated.

You can read more here: https://wiki.python.org/moin/DbusExamples

To be honest it seems that pydbus is not actively maintained today, the last release is from 2016. There is a third way which is to use GDBus from GLib using PyGObject.

lb90
  • 828
  • 4
  • 8
  • 1
    Thanks for the answer... GDBus from Glib - are there any samples howtos? I usually find it very hard to translate the C-api to the python one. As you said pydbus is not really maintained however dbus-python gets monthly commits in its repos so maybe not deprecated? As said I'm confused. – enaut Nov 01 '19 at 13:24
  • Hmm I could not find an example in Python for a server from a rapid search. Here is a nice example for a client: https://aleksander.es/data/GNOMEASIA2014%20-%20Introduction%20to%20DBus.pdf – lb90 Nov 01 '19 at 14:00
  • And here is an answer with some good advice: https://stackoverflow.com/questions/54113389/migration-from-dbus-to-gdbus-in-python-3 – lb90 Nov 01 '19 at 14:06
  • So... in summary so far - there are two pythonic options both with uncertain future and one stable api that is rather hard to use. Thanks for your advice. – enaut Nov 01 '19 at 14:37
  • `pydbus` does not support async calls, even though a PR adding them has submitted for a long time, but it has not been merged yet and I don't see signs of that happening soon or ever. – Chris Arndt Nov 06 '19 at 17:36
2

Since pydbus development is practically dead since 2018 the best choice for a pythonic implementation is probably dasbus. Dasbus is directly inspired by pydbus, intended to replace it and is in active development.

rautesamtr
  • 21
  • 2