{"id":3954,"library":"dbus-fast","title":"dbus-fast","description":"dbus-fast is a high-performance Python library for interacting with the D-Bus message bus, providing an asynchronous API built on `asyncio`. It aims to be a faster and more modern alternative to older D-Bus libraries, focusing on speed and comprehensive type-hinting support. Currently at version 4.0.4, it maintains a rapid release cadence with frequent updates and bug fixes.","status":"active","version":"4.0.4","language":"python","source_language":"en","source_url":"https://github.com/bluetooth-devices/dbus-fast","tags":["dbus","asyncio","ipc","interprocess","linux"],"install":[{"cmd":"pip install dbus-fast","lang":"bash","label":"Install stable version"}],"dependencies":[],"imports":[{"note":"The primary entry point for asynchronous D-Bus communication.","symbol":"MessageBus","correct":"from dbus_fast.aio import MessageBus"},{"note":"Used to specify connection type (SESSION or SYSTEM).","symbol":"BusType","correct":"from dbus_fast.constants import BusType"},{"note":"Essential for defining D-Bus services.","symbol":"ServiceInterface","correct":"from dbus_fast.service import ServiceInterface, method, dbus_property, signal"},{"note":"Represents a D-Bus variant type.","symbol":"Variant","correct":"from dbus_fast import Variant"}],"quickstart":{"code":"import asyncio\nfrom dbus_fast.aio import MessageBus\nfrom dbus_fast.constants import BusType\n\nasync def main():\n    # Connect to the system bus. For the user session bus, use BusType.SESSION.\n    bus = await MessageBus(bus_type=BusType.SYSTEM).connect()\n\n    try:\n        reply = await bus.call(\n            bus_name=\"org.freedesktop.DBus\",\n            path=\"/org/freedesktop/DBus\",\n            interface=\"org.freedesktop.DBus\",\n            member=\"ListNames\",\n        )\n        names = reply.body[0]\n        print(\"D-Bus names on system bus:\", names)\n    except Exception as e:\n        print(f\"Error calling ListNames on system bus: {e}\")\n        print(\"Note: Access to the system bus typically requires specific permissions (e.g., being in a 'wheel' group or root).\")\n    finally:\n        await bus.disconnect()\n\nif __name__ == \"__main__\":\n    # Ensure this runs in an async context\n    asyncio.run(main())","lang":"python","description":"This quickstart demonstrates how to connect to the D-Bus system bus and call the standard `ListNames` method on the D-Bus daemon. It prints the names of currently registered services. Remember to run this in an `asyncio` event loop."},"warnings":[{"fix":"Update your code to expect and process Python tuples for D-Bus STRUCT types. For example, `(item1, item2)` instead of `[item1, item2]`.","message":"The representation of D-Bus STRUCT types changed from Python lists to tuples.","severity":"breaking","affected_versions":"<3.0.0"},{"fix":"Ensure your development and deployment environments are running Python 3.10 or a later version. Upgrade Python if necessary.","message":"dbus-fast requires Python 3.10 or newer.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Always `await` calls to `MessageBus` methods (e.g., `bus.connect()`, `bus.call()`) and ensure your main script uses `asyncio.run()` or similar `asyncio` entry points.","message":"dbus-fast is an asynchronous library and requires careful use of `async`/`await` within an `asyncio` event loop. Forgetting `await` or not running in a loop will lead to errors.","severity":"gotcha","affected_versions":"All versions"},{"fix":"For system bus interactions, ensure the running user has the necessary permissions. Test with `BusType.SESSION` if you only need to interact with user-level services.","message":"Accessing the D-Bus system bus (BusType.SYSTEM) often requires specific user permissions or group memberships, which can lead to `dbus_fast.errors.DbusError` (e.g., 'org.freedesktop.DBus.Error.AccessDenied').","severity":"gotcha","affected_versions":"All versions"}],"env_vars":null,"search_vec":"'4.0.4':58 'aim':31 'altern':39 'api':26 'asynchron':25 'asyncio':29,72 'bug':69 'built':27 'bus':20,22,44 'cadenc':64 'comprehens':50 'current':55 'd':19,43 'd-bus':18,42 'dbus':2,5,71 'dbus-fast':1,4 'fast':3,6 'faster':35 'fix':70 'focus':46 'frequent':66 'high':10 'high-perform':9 'hint':53 'interact':15 'interprocess':74 'ipc':73 'librari':13,45 'linux':75 'maintain':60 'messag':21 'modern':38 'older':41 'perform':11 'provid':23 'python':12 'rapid':62 'releas':63 'speed':48 'support':54 'type':52 'type-hint':51 'updat':67 'version':57","created_at":"2026-04-12T03:34:45.310761+00:00","updated_at":"2026-04-16T05:53:09.251366+00:00","problems":[{"fix":"Ensure 'dbus-fast' is installed using pip: `pip install dbus-fast`. If using virtual environments, activate the correct environment before running the code.","cause":"The 'dbus-fast' library is not installed in the current Python environment, or the environment where the code is being executed cannot locate the installed package.","error":"ImportError: No module named 'dbus_fast'"},{"fix":"Ensure you are importing and instantiating the correct `MessageBus` implementation, typically `from dbus_fast.aio import MessageBus` for asyncio, and then use `await bus.get_proxy_object(bus_name, object_path, introspection_xml)`.","cause":"This error often occurs when trying to use an API method from a different D-Bus library (e.g., 'dbus-python') or when incorrectly instantiating the MessageBus object. In `dbus-fast`, `get_proxy_object` is a method of the specific asynchronous MessageBus implementations (like `aio.MessageBus` or `glib.MessageBus`), not necessarily a generic 'Bus' object or `BaseMessageBus`.","error":"AttributeError: 'Bus' object has no attribute 'get_proxy_object'"},{"fix":"Reinstall `dbus-fast` cleanly, ideally in a fresh virtual environment: `pip uninstall dbus-fast && pip install dbus-fast`. If the problem persists, try `pip install dbus-fast --no-cache-dir` or consider updating `pip` and `setuptools`.","cause":"This specific error message indicates a binary incompatibility or version mismatch within `dbus-fast` or its underlying components, possibly due to a partial upgrade, cached build artifacts, or conflicts with other installed packages, especially if optional Cython extensions are involved.","error":"dbus_fast.signature.Variant size changed, may indicate binary incompatibility"},{"fix":"Implement robust error handling around D-Bus communication to catch `EOFError` (and `dbus_fast.errors.DBusError`) and logic to gracefully reconnect the `MessageBus` if the connection is lost. Verify the stability and availability of the D-Bus service you are interacting with.","cause":"An `EOFError` in the context of `dbus-fast` typically signifies that the D-Bus connection has been unexpectedly closed or terminated by the remote peer or the D-Bus daemon itself, often due to the service crashing, being stopped, or network issues.","error":"EOFError"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":"5.0.22","cli_name":"","cli_version":null,"type":"library","homepage":null,"github":"https://github.com/bluetooth-devices/dbus-fast","docs":"https://dbus-fast.readthedocs.io","changelog":"https://github.com/bluetooth-devices/dbus-fast/blob/main/CHANGELOG.md","pypi":"https://pypi.org/project/dbus-fast/","npm":null,"openapi_spec":null,"status_page":null,"smithery":null,"categories":["communication"],"base_url":null,"auth_type":null,"provenance":{"verified_status":"passing","verified_at":"2026-06-28","last_verified":"2026-08-29","next_check":"2026-07-28","install_tag":null}}