Skip to main content

pysdbus

pysdbus is a Python wrapper library for DBus inter-process communication. It uses Python's ctypes module to communicate directly with the sd-bus C API of the systemd library. Hence, pysdbus only depends on the presence of the libsystemd.so library and a functional Python interpreter in version 2 or 3.

pysdbus offers three APIs:

  • pysdbus.llapi is the low-level API and a thin ctypes wrapper around libsystemd's C API
  • pysdbus is the main API of this library and provides additional convenience around the low-level API
  • pysdbus.dbus aims to provide a programming interface similar to the well-known dbus-python project

Status

This library is still in an early stage. Many features are still missing but calling and offering APIs with methods, signals and properties is already implemented.

pysdbus example

import pysdbus

bus = pysdbus.SystemBus()

obj = bus.getObject("org.freedesktop.DBus", "/org/freedesktop/DBus")

iface = obj.getInterface("org.freedesktop.DBus")

reply = iface.ListNames()

for service in reply:
        print(service)

pysdbus.dbus example

ml = MainLoop()

bus = SystemBus()

dbus_obj = bus.get_object("org.freedesktop.DBus", "/org/freedesktop/DBus")

iface = Interface(dbus_obj, "org.freedesktop.DBus")

reply = iface.ListNames()

print(reply)

def prop_changed_cb(sender, destination, path, interface, member):
	print("new signal: ", sender, destination, path, interface, member)

bus.add_signal_receiver(prop_changed_cb)

def nameowner_changed_cb(sender, destination, path, interface, member):
	print("nameowner changed: ", sender, destination, path, interface, member)

iface.connect_to_signal("NameOwnerChanged", nameowner_changed_cb)

ml.run()

Release files for pysdbus 2023.12.25

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pysdbus 2023.12.25
File Size Uploaded
pysdbus-2023.12.25.tar.gz 41.8 kB Details

Release files / pysdbus-2023.12.25.tar.gz

Download URL pysdbus-2023.12.25.tar.gz
Size 41.8 kB
Tags Source
SHA-256 checksum
How to use checksums
0662d826c75f203db163d31d32d3ca5ad512f658c115c24526f7dd4a30193cb3
BLAKE2b-256 checksum
How to use checksums
fce50468e5b0bef9be7568b7471f5996a174d1127af508d3a59e842bc7b77233
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.10.12

Release history Release notifications | RSS feed

This release

2023.12.25 This release

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page