xbloom-py 0.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- xbloom_py-0.1.0/.github/workflows/publish.yml +34 -0
- xbloom_py-0.1.0/.github/workflows/test.yml +35 -0
- xbloom_py-0.1.0/.gitignore +8 -0
- xbloom_py-0.1.0/CHANGELOG.md +16 -0
- xbloom_py-0.1.0/LICENSE +21 -0
- xbloom_py-0.1.0/PKG-INFO +95 -0
- xbloom_py-0.1.0/README.md +65 -0
- xbloom_py-0.1.0/docs/superpowers/plans/2026-08-27-xbloom-py-packaging.md +858 -0
- xbloom_py-0.1.0/docs/superpowers/specs/2026-08-27-xbloom-py-design.md +122 -0
- xbloom_py-0.1.0/pyproject.toml +43 -0
- xbloom_py-0.1.0/src/xbloom/__init__.py +21 -0
- xbloom_py-0.1.0/src/xbloom/ble.py +1388 -0
- xbloom_py-0.1.0/src/xbloom/brew_scale.py +62 -0
- xbloom_py-0.1.0/src/xbloom/client.py +146 -0
- xbloom_py-0.1.0/src/xbloom/cloud.py +536 -0
- xbloom_py-0.1.0/src/xbloom/exceptions.py +25 -0
- xbloom_py-0.1.0/src/xbloom/mode_listener.py +355 -0
- xbloom_py-0.1.0/src/xbloom/models.py +59 -0
- xbloom_py-0.1.0/src/xbloom/ota.py +250 -0
- xbloom_py-0.1.0/src/xbloom/py.typed +0 -0
- xbloom_py-0.1.0/src/xbloom/recipe_validate.py +250 -0
- xbloom_py-0.1.0/src/xbloom/spec.py +349 -0
- xbloom_py-0.1.0/tests/conftest.py +24 -0
- xbloom_py-0.1.0/tests/test_adapter_derivation.py +116 -0
- xbloom_py-0.1.0/tests/test_ble_ack_gating.py +349 -0
- xbloom_py-0.1.0/tests/test_ble_firmware.py +172 -0
- xbloom_py-0.1.0/tests/test_ble_spec.py +42 -0
- xbloom_py-0.1.0/tests/test_brew_scale.py +75 -0
- xbloom_py-0.1.0/tests/test_cloud.py +316 -0
- xbloom_py-0.1.0/tests/test_ota.py +72 -0
- xbloom_py-0.1.0/tests/test_recipe_blob_gate.py +144 -0
- xbloom_py-0.1.0/tests/test_spec_parity.py +162 -0
- xbloom_py-0.1.0/tests/test_validate_behaviour.py +107 -0
- xbloom_py-0.1.0/uv.lock +1142 -0
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
name: publish
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
tags: ["v*"]
|
|
6
|
+
|
|
7
|
+
jobs:
|
|
8
|
+
build:
|
|
9
|
+
runs-on: ubuntu-latest
|
|
10
|
+
steps:
|
|
11
|
+
- uses: actions/checkout@v7
|
|
12
|
+
- uses: astral-sh/setup-uv@v10.0.1
|
|
13
|
+
with:
|
|
14
|
+
python-version: "3.12"
|
|
15
|
+
- run: uv sync --all-extras
|
|
16
|
+
- run: uv run pytest -q
|
|
17
|
+
- run: uv build
|
|
18
|
+
- uses: actions/upload-artifact@v7
|
|
19
|
+
with:
|
|
20
|
+
name: dist
|
|
21
|
+
path: dist/
|
|
22
|
+
|
|
23
|
+
publish:
|
|
24
|
+
needs: build
|
|
25
|
+
runs-on: ubuntu-latest
|
|
26
|
+
environment: pypi
|
|
27
|
+
permissions:
|
|
28
|
+
id-token: write
|
|
29
|
+
steps:
|
|
30
|
+
- uses: actions/download-artifact@v8
|
|
31
|
+
with:
|
|
32
|
+
name: dist
|
|
33
|
+
path: dist/
|
|
34
|
+
- uses: pypa/gh-action-pypi-publish@release/v1
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
name: test
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: [main]
|
|
6
|
+
pull_request:
|
|
7
|
+
workflow_dispatch:
|
|
8
|
+
|
|
9
|
+
jobs:
|
|
10
|
+
pytest:
|
|
11
|
+
runs-on: ubuntu-latest
|
|
12
|
+
strategy:
|
|
13
|
+
fail-fast: false
|
|
14
|
+
matrix:
|
|
15
|
+
python-version: ["3.12", "3.13"]
|
|
16
|
+
extras: ["all", "none"]
|
|
17
|
+
name: py${{ matrix.python-version }} extras=${{ matrix.extras }}
|
|
18
|
+
steps:
|
|
19
|
+
- uses: actions/checkout@v7
|
|
20
|
+
|
|
21
|
+
- name: Install uv
|
|
22
|
+
uses: astral-sh/setup-uv@v10.0.1
|
|
23
|
+
with:
|
|
24
|
+
python-version: ${{ matrix.python-version }}
|
|
25
|
+
|
|
26
|
+
- name: Install with all extras
|
|
27
|
+
if: matrix.extras == 'all'
|
|
28
|
+
run: uv sync --all-extras
|
|
29
|
+
|
|
30
|
+
- name: Install with no extras
|
|
31
|
+
if: matrix.extras == 'none'
|
|
32
|
+
run: uv sync --only-group dev
|
|
33
|
+
|
|
34
|
+
- name: Run tests
|
|
35
|
+
run: uv run pytest -q
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
## 0.1.0 — 2026-08-27
|
|
4
|
+
|
|
5
|
+
First release. Extracted, with its history, from the vendored library inside the
|
|
6
|
+
xBloom Studio Home Assistant integration, where it had lived since 2026-07-13.
|
|
7
|
+
|
|
8
|
+
- BLE protocol: frame encode/decode, ACK-gated send/confirm, packet builders,
|
|
9
|
+
recipe blob encoding
|
|
10
|
+
- `spec`: machine constants centralised as the single source of truth, with a
|
|
11
|
+
parity test guarding the values against their pre-refactor snapshot
|
|
12
|
+
- Recipe validation, normalisation and scaling
|
|
13
|
+
- Arm-gated OTA firmware flashing
|
|
14
|
+
- Optional cloud account: login, recipe CRUD, firmware version check
|
|
15
|
+
- BLE and cloud dependencies are extras, so the package installs alongside Home
|
|
16
|
+
Assistant without disturbing its pinned versions
|
xbloom_py-0.1.0/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Mansour Alshekhi
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
xbloom_py-0.1.0/PKG-INFO
ADDED
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
|
+
Name: xbloom-py
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Async Python library for xBloom Studio coffee brewers: BLE protocol, recipes, OTA and cloud
|
|
5
|
+
Project-URL: Homepage, https://github.com/Alshekhi/xbloom-py
|
|
6
|
+
Project-URL: Issues, https://github.com/Alshekhi/xbloom-py/issues
|
|
7
|
+
Author: Mansour Alshekhi
|
|
8
|
+
License-Expression: MIT
|
|
9
|
+
License-File: LICENSE
|
|
10
|
+
Keywords: ble,bluetooth,brewing,coffee,home-assistant,xbloom
|
|
11
|
+
Classifier: Development Status :: 4 - Beta
|
|
12
|
+
Classifier: Intended Audience :: Developers
|
|
13
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
15
|
+
Classifier: Topic :: Home Automation
|
|
16
|
+
Classifier: Typing :: Typed
|
|
17
|
+
Requires-Python: >=3.12
|
|
18
|
+
Provides-Extra: all
|
|
19
|
+
Requires-Dist: aiohttp>=3.9; extra == 'all'
|
|
20
|
+
Requires-Dist: bleak-retry-connector>=3.5; extra == 'all'
|
|
21
|
+
Requires-Dist: bleak>=0.22; extra == 'all'
|
|
22
|
+
Requires-Dist: cryptography>=42; extra == 'all'
|
|
23
|
+
Provides-Extra: ble
|
|
24
|
+
Requires-Dist: bleak-retry-connector>=3.5; extra == 'ble'
|
|
25
|
+
Requires-Dist: bleak>=0.22; extra == 'ble'
|
|
26
|
+
Provides-Extra: cloud
|
|
27
|
+
Requires-Dist: aiohttp>=3.9; extra == 'cloud'
|
|
28
|
+
Requires-Dist: cryptography>=42; extra == 'cloud'
|
|
29
|
+
Description-Content-Type: text/markdown
|
|
30
|
+
|
|
31
|
+
# xbloom-py
|
|
32
|
+
|
|
33
|
+
Async Python library for [xBloom Studio](https://xbloom.com) coffee brewers:
|
|
34
|
+
the BLE protocol, recipe validation, over-the-air firmware updates, and the
|
|
35
|
+
optional cloud account API.
|
|
36
|
+
|
|
37
|
+
Unofficial and not affiliated with xBloom. The protocol was derived by static
|
|
38
|
+
analysis of the vendor's mobile applications.
|
|
39
|
+
|
|
40
|
+
## Install
|
|
41
|
+
|
|
42
|
+
```bash
|
|
43
|
+
pip install xbloom-py # pure-python core: spec, recipes, validation
|
|
44
|
+
pip install "xbloom-py[ble]" # + local Bluetooth control
|
|
45
|
+
pip install "xbloom-py[cloud]" # + cloud account, recipe sync, firmware check
|
|
46
|
+
pip install "xbloom-py[all]" # everything
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
Import as `xbloom`:
|
|
50
|
+
|
|
51
|
+
```python
|
|
52
|
+
from xbloom import spec, recipe_validate
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
Dependencies are declared with lower bounds only and no upper pins, so the
|
|
56
|
+
package can be installed alongside Home Assistant without disturbing the
|
|
57
|
+
versions it pins itself.
|
|
58
|
+
|
|
59
|
+
## What is in it
|
|
60
|
+
|
|
61
|
+
| Module | Needs | What it does |
|
|
62
|
+
|---|---|---|
|
|
63
|
+
| `spec` | — | Machine constants: ranges, enums, pattern and unit maps. The single source of truth. |
|
|
64
|
+
| `recipe_validate` | — | Validate and normalise recipe dictionaries. |
|
|
65
|
+
| `brew_scale` | — | Scale a recipe's dose and water. |
|
|
66
|
+
| `models` | — | Recipe and reading dataclasses. |
|
|
67
|
+
| `exceptions` | — | `XBloomError`, `XBloomAPIError`. |
|
|
68
|
+
| `ble` | `[ble]` at runtime | Frame encoding/decoding, ACK-gated send/confirm, packet builders. |
|
|
69
|
+
| `ota` | `[ble]` at runtime | Validated, arm-gated firmware flashing. |
|
|
70
|
+
| `mode_listener` | `[ble]` at runtime | Live knob and scale event stream. |
|
|
71
|
+
| `client` | `[cloud]` | Share-link recipe fetching. |
|
|
72
|
+
| `cloud` | `[cloud]` | Account login, recipe CRUD, firmware version check. |
|
|
73
|
+
|
|
74
|
+
`ble`, `ota` and `mode_listener` import their Bluetooth dependencies lazily, so
|
|
75
|
+
they can be imported for packet construction with no extras installed.
|
|
76
|
+
|
|
77
|
+
## Status
|
|
78
|
+
|
|
79
|
+
`0.x` — the API is settling. It has one production consumer today (the
|
|
80
|
+
[xBloom Studio Home Assistant integration](https://github.com/Alshekhi/xbloom-studio));
|
|
81
|
+
`1.0.0` follows once a second consumer has proven the module boundaries.
|
|
82
|
+
|
|
83
|
+
## Development
|
|
84
|
+
|
|
85
|
+
```bash
|
|
86
|
+
uv sync --all-extras
|
|
87
|
+
uv run pytest
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
The suite runs without extras too; `test_cloud.py` is skipped when `aiohttp`
|
|
91
|
+
and `cryptography` are absent.
|
|
92
|
+
|
|
93
|
+
## License
|
|
94
|
+
|
|
95
|
+
MIT
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
# xbloom-py
|
|
2
|
+
|
|
3
|
+
Async Python library for [xBloom Studio](https://xbloom.com) coffee brewers:
|
|
4
|
+
the BLE protocol, recipe validation, over-the-air firmware updates, and the
|
|
5
|
+
optional cloud account API.
|
|
6
|
+
|
|
7
|
+
Unofficial and not affiliated with xBloom. The protocol was derived by static
|
|
8
|
+
analysis of the vendor's mobile applications.
|
|
9
|
+
|
|
10
|
+
## Install
|
|
11
|
+
|
|
12
|
+
```bash
|
|
13
|
+
pip install xbloom-py # pure-python core: spec, recipes, validation
|
|
14
|
+
pip install "xbloom-py[ble]" # + local Bluetooth control
|
|
15
|
+
pip install "xbloom-py[cloud]" # + cloud account, recipe sync, firmware check
|
|
16
|
+
pip install "xbloom-py[all]" # everything
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
Import as `xbloom`:
|
|
20
|
+
|
|
21
|
+
```python
|
|
22
|
+
from xbloom import spec, recipe_validate
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
Dependencies are declared with lower bounds only and no upper pins, so the
|
|
26
|
+
package can be installed alongside Home Assistant without disturbing the
|
|
27
|
+
versions it pins itself.
|
|
28
|
+
|
|
29
|
+
## What is in it
|
|
30
|
+
|
|
31
|
+
| Module | Needs | What it does |
|
|
32
|
+
|---|---|---|
|
|
33
|
+
| `spec` | — | Machine constants: ranges, enums, pattern and unit maps. The single source of truth. |
|
|
34
|
+
| `recipe_validate` | — | Validate and normalise recipe dictionaries. |
|
|
35
|
+
| `brew_scale` | — | Scale a recipe's dose and water. |
|
|
36
|
+
| `models` | — | Recipe and reading dataclasses. |
|
|
37
|
+
| `exceptions` | — | `XBloomError`, `XBloomAPIError`. |
|
|
38
|
+
| `ble` | `[ble]` at runtime | Frame encoding/decoding, ACK-gated send/confirm, packet builders. |
|
|
39
|
+
| `ota` | `[ble]` at runtime | Validated, arm-gated firmware flashing. |
|
|
40
|
+
| `mode_listener` | `[ble]` at runtime | Live knob and scale event stream. |
|
|
41
|
+
| `client` | `[cloud]` | Share-link recipe fetching. |
|
|
42
|
+
| `cloud` | `[cloud]` | Account login, recipe CRUD, firmware version check. |
|
|
43
|
+
|
|
44
|
+
`ble`, `ota` and `mode_listener` import their Bluetooth dependencies lazily, so
|
|
45
|
+
they can be imported for packet construction with no extras installed.
|
|
46
|
+
|
|
47
|
+
## Status
|
|
48
|
+
|
|
49
|
+
`0.x` — the API is settling. It has one production consumer today (the
|
|
50
|
+
[xBloom Studio Home Assistant integration](https://github.com/Alshekhi/xbloom-studio));
|
|
51
|
+
`1.0.0` follows once a second consumer has proven the module boundaries.
|
|
52
|
+
|
|
53
|
+
## Development
|
|
54
|
+
|
|
55
|
+
```bash
|
|
56
|
+
uv sync --all-extras
|
|
57
|
+
uv run pytest
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
The suite runs without extras too; `test_cloud.py` is skipped when `aiohttp`
|
|
61
|
+
and `cryptography` are absent.
|
|
62
|
+
|
|
63
|
+
## License
|
|
64
|
+
|
|
65
|
+
MIT
|