bleak-pythonista


Namebleak-pythonista JSON
Version 0.1.0 PyPI version JSON
download
home_pageNone
Summarybleak compatible pythonista.cb backend
upload_time2025-07-29 21:48:35
maintainerNone
docs_urlNone
authorDmytro Yaroshenko
requires_python>=3.9
licenseMIT License Copyright (c) 2025, Dmytro Yaroshenko Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
keywords bleak python pythonista ble
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # `Bleak` compatible backend for `Pythonista` iOS app

[![license]][MIT]
[![pypi]][PyPiUrl]
[![py-versions]][sources]
[![Made in Ukraine]][SWUBadge]

[![Pytest](https://github.com/o-murphy/bleak-pythonista/actions/workflows/pytest.yml/badge.svg)](https://github.com/o-murphy/bleak-pythonista/actions/workflows/pytest.yml)
[![Mypy](https://github.com/o-murphy/bleak-pythonista/actions/workflows/mypy.yml/badge.svg)](https://github.com/o-murphy/bleak-pythonista/actions/workflows/mypy.yml)
[![Ruff](https://github.com/o-murphy/bleak-pythonista/actions/workflows/ruff.yml/badge.svg)](https://github.com/o-murphy/bleak-pythonista/actions/workflows/ruff.yml)


[sources]:
https://github.com/o-murphy/bleak-pythonista

[license]:
https://img.shields.io/github/license/o-murphy/bleak-pythonista?style=flat-square

[MIT]:
https://opensource.org/license/MIT

[pypi]:
https://img.shields.io/pypi/v/bleak-pythonista?style=flat-square&logo=pypi

[PyPiUrl]:
https://pypi.org/project/bleak-pythonista/

[pepy]:
https://pepy.tech/project/bleak-pythonista

[py-versions]:
https://img.shields.io/pypi/pyversions/bleak-pythonista?style=flat-square

[Made in Ukraine]:
https://img.shields.io/badge/made_in-Ukraine-ffd700.svg?labelColor=0057b7&style=flat-square

[SWUBadge]:
https://stand-with-ukraine.pp.ua

**This module uses `bleak` backend API to implement a compatible solution for `Pythonista` iOS app. 
It uses Pythonista built-in `_cb` module, that is wrapper to iOS `CoreBluetooth`.**

> [!CAUTION]
> This project is in `beta`, use it with caution

* This backend refers to [Pythonista.cb docs](https://omz-software.com/pythonista/docs/ios/cb.html)
* This backend refers to existing [`macOS CoreBluetooth bleak backend`](https://github.com/hbldh/bleak/tree/develop/bleak/backends/corebluetooth) was used as a reference
* It also provides stub files for pythonista built-in modules as `_cb` and `pythonista.cb`, and fake `_cb.py` implementation for testing on unsupported platforms
* Use [`Bleak` docs](https://github.com/hbldh/bleak/blob/develop/README.rst) to explore how to use `Bleak`

## Table of Contents
* [Installation](#installation)
* [Usage](#usage)
* [What's done?](#whats-done)


## Installation
```Bash
pip install bleak-pythonista
```

## Usage
Direct import
```python
import asyncio
from bleak_pythonista import BleakScanner, BleakClient

async def main():
    devices = await BleakScanner.discover(
        service_uuids=["<some-service-uuid>"]  # optional
    )
    for d in devices:
        print(d)        
        client = BleakClient(d)
        await client.connect()
        print(client.services)
    
asyncio.run(main())
```

With `bleak` itself
```python
import asyncio
from bleak import BleakScanner, BleakClient
from bleak_pythonista import BleakScannerPythonistaCB, BleakClientPythonistaCB

async def main():
    devices = await BleakScanner.discover(
        service_uuids=["<some-service-uuid>"],  # optional
        backend=BleakScannerPythonistaCB,
    )
    for d in devices:
        print(d)        
        client = BleakClient(d, backend=BleakClientPythonistaCB)
        await client.connect()
        print(client.services)
    
asyncio.run(main())
```

> [!WARNING]
> DO NOT NAME YOUR SCRIPT `bleak.py` or `bleak_pythonista`! It will cause a circular import error.

## What's done?

* CentralManagerDelegate (for now for scanning purpose only)
* client.BleakClientPythonistaCB
* scanner.BleakScannerPythonistaCB
* `_cb` and `pythonista.cb` stubs
* fake `cb.py` for testing with backend simulation on unsupported platforms 

> [!TIP]
> THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "bleak-pythonista",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.9",
    "maintainer_email": null,
    "keywords": "bleak, python, pythonista, ble",
    "author": "Dmytro Yaroshenko",
    "author_email": null,
    "download_url": "https://files.pythonhosted.org/packages/87/78/fff2ba791c684cfedb5d02aa3dfddc215bd4bc995382465b1105bfb2031f/bleak_pythonista-0.1.0.tar.gz",
    "platform": null,
    "description": "# `Bleak` compatible backend for `Pythonista` iOS app\n\n[![license]][MIT]\n[![pypi]][PyPiUrl]\n[![py-versions]][sources]\n[![Made in Ukraine]][SWUBadge]\n\n[![Pytest](https://github.com/o-murphy/bleak-pythonista/actions/workflows/pytest.yml/badge.svg)](https://github.com/o-murphy/bleak-pythonista/actions/workflows/pytest.yml)\n[![Mypy](https://github.com/o-murphy/bleak-pythonista/actions/workflows/mypy.yml/badge.svg)](https://github.com/o-murphy/bleak-pythonista/actions/workflows/mypy.yml)\n[![Ruff](https://github.com/o-murphy/bleak-pythonista/actions/workflows/ruff.yml/badge.svg)](https://github.com/o-murphy/bleak-pythonista/actions/workflows/ruff.yml)\n\n\n[sources]:\nhttps://github.com/o-murphy/bleak-pythonista\n\n[license]:\nhttps://img.shields.io/github/license/o-murphy/bleak-pythonista?style=flat-square\n\n[MIT]:\nhttps://opensource.org/license/MIT\n\n[pypi]:\nhttps://img.shields.io/pypi/v/bleak-pythonista?style=flat-square&logo=pypi\n\n[PyPiUrl]:\nhttps://pypi.org/project/bleak-pythonista/\n\n[pepy]:\nhttps://pepy.tech/project/bleak-pythonista\n\n[py-versions]:\nhttps://img.shields.io/pypi/pyversions/bleak-pythonista?style=flat-square\n\n[Made in Ukraine]:\nhttps://img.shields.io/badge/made_in-Ukraine-ffd700.svg?labelColor=0057b7&style=flat-square\n\n[SWUBadge]:\nhttps://stand-with-ukraine.pp.ua\n\n**This module uses `bleak` backend API to implement a compatible solution for `Pythonista` iOS app. \nIt uses Pythonista built-in `_cb` module, that is wrapper to iOS `CoreBluetooth`.**\n\n> [!CAUTION]\n> This project is in `beta`, use it with caution\n\n* This backend refers to [Pythonista.cb docs](https://omz-software.com/pythonista/docs/ios/cb.html)\n* This backend refers to existing [`macOS CoreBluetooth bleak backend`](https://github.com/hbldh/bleak/tree/develop/bleak/backends/corebluetooth) was used as a reference\n* It also provides stub files for pythonista built-in modules as `_cb` and `pythonista.cb`, and fake `_cb.py` implementation for testing on unsupported platforms\n* Use [`Bleak` docs](https://github.com/hbldh/bleak/blob/develop/README.rst) to explore how to use `Bleak`\n\n## Table of Contents\n* [Installation](#installation)\n* [Usage](#usage)\n* [What's done?](#whats-done)\n\n\n## Installation\n```Bash\npip install bleak-pythonista\n```\n\n## Usage\nDirect import\n```python\nimport asyncio\nfrom bleak_pythonista import BleakScanner, BleakClient\n\nasync def main():\n    devices = await BleakScanner.discover(\n        service_uuids=[\"<some-service-uuid>\"]  # optional\n    )\n    for d in devices:\n        print(d)        \n        client = BleakClient(d)\n        await client.connect()\n        print(client.services)\n    \nasyncio.run(main())\n```\n\nWith `bleak` itself\n```python\nimport asyncio\nfrom bleak import BleakScanner, BleakClient\nfrom bleak_pythonista import BleakScannerPythonistaCB, BleakClientPythonistaCB\n\nasync def main():\n    devices = await BleakScanner.discover(\n        service_uuids=[\"<some-service-uuid>\"],  # optional\n        backend=BleakScannerPythonistaCB,\n    )\n    for d in devices:\n        print(d)        \n        client = BleakClient(d, backend=BleakClientPythonistaCB)\n        await client.connect()\n        print(client.services)\n    \nasyncio.run(main())\n```\n\n> [!WARNING]\n> DO NOT NAME YOUR SCRIPT `bleak.py` or `bleak_pythonista`! It will cause a circular import error.\n\n## What's done?\n\n* CentralManagerDelegate (for now for scanning purpose only)\n* client.BleakClientPythonistaCB\n* scanner.BleakScannerPythonistaCB\n* `_cb` and `pythonista.cb` stubs\n* fake `cb.py` for testing with backend simulation on unsupported platforms \n\n> [!TIP]\n> THE SOFTWARE IS PROVIDED \u201cAS IS\u201d, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n",
    "bugtrack_url": null,
    "license": "MIT License  Copyright (c) 2025, Dmytro Yaroshenko  Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:  The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.  THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.",
    "summary": "bleak compatible pythonista.cb backend",
    "version": "0.1.0",
    "project_urls": {
        "Bug Reports": "https://github.com/o-murphy/bleak-pythonista/issues",
        "Homepage": "https://github.com/o-murphy/bleak-pythonista",
        "Source": "https://github.com/o-murphy/bleak-pythonista"
    },
    "split_keywords": [
        "bleak",
        " python",
        " pythonista",
        " ble"
    ],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "8d210a75666f09a93c8e018f7c5420a92497d62efdc01a9a95b95f847208d549",
                "md5": "f694fb9f903c788f100dba7fe7037135",
                "sha256": "816091ed6fa485a5318de2a00138219844606ba322428b9b460b9c3520d57cb6"
            },
            "downloads": -1,
            "filename": "bleak_pythonista-0.1.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "f694fb9f903c788f100dba7fe7037135",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.9",
            "size": 24201,
            "upload_time": "2025-07-29T21:48:34",
            "upload_time_iso_8601": "2025-07-29T21:48:34.139424Z",
            "url": "https://files.pythonhosted.org/packages/8d/21/0a75666f09a93c8e018f7c5420a92497d62efdc01a9a95b95f847208d549/bleak_pythonista-0.1.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "8778fff2ba791c684cfedb5d02aa3dfddc215bd4bc995382465b1105bfb2031f",
                "md5": "e3b4a3011313f4b5ff671d4c88dbb7c8",
                "sha256": "dc370503725f17328485a33de580c2b49d635b2bd7408e1647dd1e3919e748de"
            },
            "downloads": -1,
            "filename": "bleak_pythonista-0.1.0.tar.gz",
            "has_sig": false,
            "md5_digest": "e3b4a3011313f4b5ff671d4c88dbb7c8",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.9",
            "size": 23813,
            "upload_time": "2025-07-29T21:48:35",
            "upload_time_iso_8601": "2025-07-29T21:48:35.276467Z",
            "url": "https://files.pythonhosted.org/packages/87/78/fff2ba791c684cfedb5d02aa3dfddc215bd4bc995382465b1105bfb2031f/bleak_pythonista-0.1.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-07-29 21:48:35",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "o-murphy",
    "github_project": "bleak-pythonista",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "bleak-pythonista"
}
        
Elapsed time: 1.72434s