{ "info": { "author": "CCX Technologies", "author_email": "charles@ccxtechnologies.com", "bugtrack_url": null, "classifiers": [], "description": "python-adbus\n============\n\nD-Bus Binding for Python utilizing the Python's asyncio module.\n\nStatus\n------\n\n.. image:: https://api.codacy.com/project/badge/Grade/c66c19cdcadd4c83bc4b70596d65aa7a\n :target: https://www.codacy.com/app/ccxtechnologies/python-adbus?utm_source=github.com&utm_medium=referral&utm_content=ccxtechnologies/python-adbus&utm_campaign=Badge_Grade\n\n.. image:: https://api.codacy.com/project/badge/Coverage/c66c19cdcadd4c83bc4b70596d65aa7a\n :target: https://www.codacy.com/app/ccxtechnologies/python-adbus?utm_source=github.com&utm_medium=referral&utm_content=ccxtechnologies/python-adbus&utm_campaign=Badge_Coverage\n\n\nLinks\n-----\n- `Documentation `_\n- `Project Page `_\n- `Issues `_\n\nDependencies\n------------\n\n1. Python >= 3.7\n2. libsystemd >= 232 (don\u2019t need systemd, just libsystemd which is a separate package)\n3. Cython >= 0.25.2 (only required to regenerate sdbus.c, if you make any changes)\n\nBuilding / Installing\n---------------------\n\n- To build in place for development python ./setup.py build\\_ext --inplace\n- The html documents are stored in gh-pages branch, so that GitHub will\n serve them as a GitHub Pages. To build them:\n 1. check out the gh-pages branch into ../python-adbus/html\n 2. cd into docs\n 3. sphinx-apidoc -o source/ ../adbus\n 4. make html\n\nUnit-Tests\n----------\n\nNOTE: Some test-cases require the busctl tool from systemd.\n\n- To run a specific unit-test from the root directory (eg.): python -m\n unittest tests.test\\_sdbus\\_method.Test.test\\_method\\_single\\_str\n\n- To run a specific unit-test module from the root directory (eg.):\n python -m unittest tests.test\\_sdbus\\_method\n\n- To run all unit-tests from the root directory: python -m unittest\n discover\n\nServer Examples\n---------------\n\nObject Example\n~~~~~~~~~~~~~~\n\nThis is an example of an object, which can be connected to a service.\n\n.. code-block:: python\n\n import adbus\n import typing\n\n class ExampleClass(adbus.server.Object):\n\n signal1: int = adbus.server.Signal()\n signal2: typing.List[int] = adbus.server.Signal()\n\n property1: str = adbus.server.Property('none', read_only=True, hidden=True)\n property2: typing.List[int] = adbus.server.Property(['rr', 'ff'], deprectiated=True)\n\n def __init__(self, service):\n super().__init__(service, path='/xxx/yyy', interface='yyy.xxx')\n\n @adbus.method(name='test', hidden=True)\n def test_method(self, r: int, gg: str) -> int:\n return r + 10\n\n def do_something(self):\n self.signal1.emit(14)\n\nSetting Multiple Properties\n~~~~~~~~~~~~~~~~~~~~~~~~~~~\n\nIt's possible to set multiple properties at the same time, this will defer the property\nupdate signal, and send one signal for all property changes. It's good practice to use\nthis when changing multiple properties, it will reduce traffic on the D-Bus.\n\nNOTE: Must be running in a loop.\n\n\nClient Examples\n---------------\n\nAccessing Remote Interface via a Proxy\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n\nIt's possible to map a remote interface to a local instantiated class using a Proxy.\n\nNOTE: If the even loop isn't running no signals will caught, and properties will not\ncache (i.e. will read on every access instead of tracking the property changes signals)\n\n**This is a protoype to see how it looks, it hasn't been implemented yet.**\n\n.. code-block:: python\n\n service = adbus.Service(bus='session')\n proxy = adbus.client.Proxy(service, 'com.example.xxx', '/com/example/Service1',\n interface='com.example.service.unit')\n\n async def proxy_examples():\n await proxy.update() # initialize the proxy\n\n # == Access Properties\n await proxy.remote_propertyX.set(45)\n print(await proxy.remote_propertyY.get())\n\n # == or\n await proxy.remote_propertyX(45)\n print(await proxy.remote_propertyY())\n\n # == Access Methods\n asyncio.ensure_future(proxy.remote_method_foo(\"some info\")) # don't wait for result\n x = await proxy.remote_method_bar(100, 12, -45) # wait for result\n\n # == Add a Coroutine to a Signal\n async def local_method(signal_data: int):\n print(signal_data)\n proxy.remote_signal.add(local_method)\n\n # == or\n proxy.remote_signal(local_method)\n\n # == Remove a Coroutine to a Signal\n proxy.remote_signal.remove(local_method)\n\n # == or (if already added)\n proxy.remote_signal(local_method)\n\n # == Access a method using a different interface name\n proxy['com.example.service.serve'].remote_method_800(b\"data\")\n\n # == Create a new proxy from a node in the proxy\n proxy_new = await proxy('Test')\n\n # == Loop through all nodes in a proxy\n sum_cnt = 0\n async for node in proxy:\n try:\n sum_cnt += await node.count\n except AttributeError:\n pass\n\n # == set multiple properties in one message (if linked to an adbus based server)\n async with proxy as p:\n p.property1 = \"some data\"\n p.property2 = [1,2,3,4,5]\n\n loop = asyncio.get_event_loop()\n loop.run_until_complete(proxy_examples())\n loop.close()\n\nStyle Guide\n-----------\n\nFor a consistent style all code is run through yapf using the Facebook style:\n\nAll docstrings are in the google style.", "description_content_type": "", "docs_url": null, "download_url": "https://github.com/ccxtechnologies/archive/v1.0.1.tar.gz", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/ccxtechnologies/adbus", "keywords": "", "license": "MIT", "maintainer": "", "maintainer_email": "", "name": "adbus", "package_url": "https://pypi.org/project/adbus/", "platform": "", "project_url": "https://pypi.org/project/adbus/", "project_urls": { "Download": "https://github.com/ccxtechnologies/archive/v1.0.1.tar.gz", "Homepage": "https://github.com/ccxtechnologies/adbus" }, "release_url": "https://pypi.org/project/adbus/1.0.1/", "requires_dist": null, "requires_python": ">=3.7", "summary": "asyncio based dbus interface", "version": "1.0.1" }, "last_serial": 4845404, "releases": { "0.1.0": [ { "comment_text": "", "digests": { "md5": "1af4c83ca7f6832136b1a08b0ff22cc5", "sha256": "d1c095662a169224d0b4bfc966d286038056c79b5b222ca6f0e1b55131e77353" }, "downloads": -1, "filename": "adbus-0.1.0.tar.gz", "has_sig": false, "md5_digest": "1af4c83ca7f6832136b1a08b0ff22cc5", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 124132, "upload_time": "2017-07-26T17:48:44", "url": "https://files.pythonhosted.org/packages/bb/45/92022094b0b6300425daeaedaa10220d64f30a6046a4be942bddd757ca0a/adbus-0.1.0.tar.gz" } ], "0.1.1": [ { "comment_text": "", "digests": { "md5": "8dd067721ca5c63e099c9314ca7f3b39", "sha256": "53ae2cab1db3c1510b50bcdf043e30585f044b1600929ab8cf8adbf6632a9850" }, "downloads": -1, "filename": "adbus-0.1.1.tar.gz", "has_sig": false, "md5_digest": "8dd067721ca5c63e099c9314ca7f3b39", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 127889, "upload_time": "2017-07-26T18:15:13", "url": "https://files.pythonhosted.org/packages/87/8f/202281e956b4b76836bdf04de7b0ff9ef3a0e654b76ee04650f40170f2d1/adbus-0.1.1.tar.gz" } ], "0.2.0": [ { "comment_text": "", "digests": { "md5": "27e70b848dcf8b16320e33e8e24abb39", "sha256": "dbf182ec564f5ca9d3c51c17e4f2aa743cae45a012b17d05c27e38e7e69f20b0" }, "downloads": -1, "filename": "adbus-0.2.0.tar.gz", "has_sig": false, "md5_digest": "27e70b848dcf8b16320e33e8e24abb39", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 154816, "upload_time": "2017-08-02T14:50:58", "url": "https://files.pythonhosted.org/packages/9b/4a/1dd432e27d2b3ce05d2d20462b22a90c8c80aaa1b50b806fb2e44c4cda44/adbus-0.2.0.tar.gz" } ], "1.0.0": [ { "comment_text": "", "digests": { "md5": "46f8bf02a66c59b744196f9d8c211f60", "sha256": "5c4c3006968ea5538cdfe9c384a7ebe603f8c8ac6c7f93322a22913e750103ca" }, "downloads": -1, "filename": "adbus-1.0.0.tar.gz", "has_sig": false, "md5_digest": "46f8bf02a66c59b744196f9d8c211f60", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.7", "size": 174852, "upload_time": "2019-02-20T12:58:53", "url": "https://files.pythonhosted.org/packages/ba/c0/5517f997473d21f502682e5225d4a97a4261f6fcb942ea26837658dbb9c8/adbus-1.0.0.tar.gz" } ], "1.0.1": [ { "comment_text": "", "digests": { "md5": "869d924664a5ef07855af54b96c9bcd3", "sha256": "9f14ee6cb4c6fff52b7d9078d03a08575b6c8b4ee8db06a85be0da8c2691199c" }, "downloads": -1, "filename": "adbus-1.0.1.tar.gz", "has_sig": false, "md5_digest": "869d924664a5ef07855af54b96c9bcd3", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.7", "size": 177256, "upload_time": "2019-02-20T13:03:13", "url": "https://files.pythonhosted.org/packages/6b/3b/c989d23042502f280e09d6441e49deb12d506b17095108b6f3e362677a03/adbus-1.0.1.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "869d924664a5ef07855af54b96c9bcd3", "sha256": "9f14ee6cb4c6fff52b7d9078d03a08575b6c8b4ee8db06a85be0da8c2691199c" }, "downloads": -1, "filename": "adbus-1.0.1.tar.gz", "has_sig": false, "md5_digest": "869d924664a5ef07855af54b96c9bcd3", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.7", "size": 177256, "upload_time": "2019-02-20T13:03:13", "url": "https://files.pythonhosted.org/packages/6b/3b/c989d23042502f280e09d6441e49deb12d506b17095108b6f3e362677a03/adbus-1.0.1.tar.gz" } ] }