Registry / http-networking / sdbus
library0.14.2pypypi✓ verified 83d ago

sdbus is a modern, asynchronous Python D-Bus library built upon `sd-bus` from `libsystemd`. It provides a robust, low-level interface for D-Bus communication, supporting both system and session buses. Currently at version 0.14.2, it maintains an active release cycle with regular updates addressing bug fixes and feature enhancements.

pip install sdbus
INSTALL
IMPORT
SIG · SDBUS
S
sdbus
http-networkingpythonv0.14.2
Install
1.8s avg
Import
Disk
18MB
Pass rate
5/ 10
Env Coverage5 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v0.14.2 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.920 runs
build_error
glibc
py 3.103.920 runs
installs and imports cleanly · install 1.8s · import 0.000s · 20MB
18MB installed
● package 18MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

DbusInterfaceCommon
from sdbus import DbusInterfaceCommon
from sdbus.bus import SystemBus
DbusInterfaceCommonAsync
from sdbus import DbusInterfaceCommonAsync
from sdbus.bus import SystemBus

This quickstart demonstrates how to create and export a simple D-Bus service using `sdbus`. It connects to the SystemBus, defines an interface with a method, exports an instance of that interface, and requests a D-Bus name, keeping the service alive until interrupted. This allows other D-Bus clients to call its methods.

import sdbus import asyncio class MyService(sdbus.DbusInterface): DBUS_NAME = "org.example.MyService" DBUS_PATH = "/org/example/MyObject" DBUS_INTERFACE = "org.example.MyInterface" @sdbus.dbus_method def SayHello(self, name: str) -> str: return f"Hello, {name}!" async def main(): # Connect to the System Bus bus = await sdbus.bus.SystemBus().connect() # Export an instance of MyService service_object = MyService() bus.export(service_object) # Request a D-Bus name for the service await bus.request_name(MyService.DBUS_NAME) print(f"Service '{MyService.DBUS_NAME}' exported on path '{MyService.DBUS_PATH}'.") print("To test, run in another terminal (with busctl):") print(f"busctl call {MyService.DBUS_NAME} {MyService.DBUS_PATH} {MyService.DBUS_INTERFACE} SayHello s 'World'") print("Press Ctrl+C to exit.") # Keep the service running indefinitely await asyncio.Event().wait() if __name__ == "__main__": try: asyncio.run(main()) except KeyboardInterrupt: print("\nService stopped.")
Debug
Known issues
breakingStarting with version 0.14.0, sdbus requires Python 3.9 or higher. Version 0.13.0 was the last to support Python 3.8.
fix
Upgrade your Python environment to 3.9 or later. If you must use Python 3.8, pin your sdbus version to `<0.14.0` (e.g., `sdbus<0.14.0`).
affects: >=0.14.0
gotchaIn version 0.14.0, the default bus handling was changed. Previously, context-local variables were used, often leading to new buses being opened unnecessarily. This might change behavior if your application implicitly relies on the old context-local default bus mechanism.
fix
Explicitly manage your bus connections. Ensure you're connecting and using `SystemBus()` or `SessionBus()` instances as intended, rather than relying on implicit context-local behavior for the default bus.
affects: >=0.14.0
breakingVersion 0.12.0 significantly reworked internal undocumented classes and functions. If your code directly interacted with these internal APIs, it might break.
fix
Review your code for direct usage of `sdbus`'s internal, undocumented APIs. Update your code to use the officially documented public API. Using a type checker like `mypy` can help identify affected areas.
affects: >=0.12.0
breakingFor binary PyPI wheels of version 0.14.0 and later, there are increased minimum requirements: glibc 2.28+ (e.g., Debian 10+, Ubuntu 18.10+, RHEL/CentOS 8+) and pip 20.3+.
fix
Ensure your system meets the `glibc` and `pip` version requirements if you rely on binary wheels. If not, you might need to compile `sdbus` from source, or use an older `sdbus` version.
affects: >=0.14.0
gotchaVersion 0.14.2 fixed a segmentation fault that occurred if an export handle outlived the exported object. Older versions might crash under these specific circumstances.
fix
Upgrade to sdbus 0.14.2 or newer to prevent potential segmentation faults when managing object lifetimes, especially in scenarios where exported objects might be garbage collected before their corresponding D-Bus handles.
affects: <0.14.2
Upgrade
Version history
0.14.2latest on PyPI · released Dec 21, 2025
Audit
Dependencies

No dependency data recorded yet.

Agent activity
22 hits · last 30 days
node
20
OpenAI (training)
1
Resources
sdbus — pip install sdbus · libregistry