# BlueChi Python bindings
The BlueChi Python bindings provides a Python module to interact with the D-Bus API of BlueChi. It consists of the
following subpackages:
- `api`: auto-generated code based the BlueChi D-BUS API description
- `ext`: custom written code to simplify common tasks
## Installation
Using `pip3`:
```sh
# from PyPi
pip3 install bluechi
# or from cloned git repo
pip3 install --force dist/bluechi-<version>-py3-none-any.whl
```
## Examples
Listing all connected nodes and their current state:
```python
from bluechi.api import Controller
for node in Controller().list_nodes():
# node[name, obj_path, status]
print(f"Node: {node[0]}, State: {node[3]}")
```
Starting and stopping of a systemd unit on a specific node using the `Unit` class from the `ext` subpackage to
implicitly wait for the job to finish:
```python
from bluechi.ext import Unit
hu = Unit("my-node-name")
result = hu.start_unit("chronyd.service")
print(result)
result = hu.stop_unit("chronyd.service")
print(result)
```
Raw data
{
"_id": null,
"home_page": "https://github.com/eclipse-bluechi/bluechi/",
"name": "bluechi",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.9",
"maintainer_email": null,
"keywords": "bluechi, python, D-Bus, systemd",
"author": "BlueChi developers",
"author_email": null,
"download_url": null,
"platform": null,
"description": "# BlueChi Python bindings\n\nThe BlueChi Python bindings provides a Python module to interact with the D-Bus API of BlueChi. It consists of the\nfollowing subpackages:\n\n- `api`: auto-generated code based the BlueChi D-BUS API description\n- `ext`: custom written code to simplify common tasks\n\n## Installation\n\nUsing `pip3`:\n\n```sh\n# from PyPi\npip3 install bluechi\n# or from cloned git repo\npip3 install --force dist/bluechi-<version>-py3-none-any.whl\n```\n\n## Examples\n\nListing all connected nodes and their current state:\n\n```python\nfrom bluechi.api import Controller\n\nfor node in Controller().list_nodes():\n # node[name, obj_path, status]\n print(f\"Node: {node[0]}, State: {node[3]}\")\n```\n\nStarting and stopping of a systemd unit on a specific node using the `Unit` class from the `ext` subpackage to\nimplicitly wait for the job to finish:\n\n```python\nfrom bluechi.ext import Unit\n\nhu = Unit(\"my-node-name\")\n\nresult = hu.start_unit(\"chronyd.service\")\nprint(result)\n\nresult = hu.stop_unit(\"chronyd.service\")\nprint(result)\n```\n",
"bugtrack_url": null,
"license": "LGPL-2.1-or-later",
"summary": "Python bindings for BlueChi's D-Bus API",
"version": "0.9.0",
"project_urls": {
"Homepage": "https://github.com/eclipse-bluechi/bluechi/"
},
"split_keywords": [
"bluechi",
" python",
" d-bus",
" systemd"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "e7c498bf062f6cace99a116fe0a30fba9ee1d66fdb3b351d657eae70029b3228",
"md5": "8b1602e7004c151d7433fae71439c1e7",
"sha256": "c3030cf9ea05ea894e7c489afda958055e4b4ab1536e9d0c6c1f922a49047bed"
},
"downloads": -1,
"filename": "bluechi-0.9.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "8b1602e7004c151d7433fae71439c1e7",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.9",
"size": 19966,
"upload_time": "2024-11-12T15:39:51",
"upload_time_iso_8601": "2024-11-12T15:39:51.876410Z",
"url": "https://files.pythonhosted.org/packages/e7/c4/98bf062f6cace99a116fe0a30fba9ee1d66fdb3b351d657eae70029b3228/bluechi-0.9.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-11-12 15:39:51",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "eclipse-bluechi",
"github_project": "bluechi",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"requirements": [],
"lcname": "bluechi"
}