Build and test
Run the tests, lint, type checks and the documentation check that CI runs.
Tests run against a pinned Home Assistant version with uv. Python 3.14.2 or newer is required.
uv sync --locked # create .venv from uv.lock
uv run pytest
uv run ruff check custom_components tests
uv run ruff format --check custom_components tests
uv run mypypyproject.toml holds the dev dependency group: pytest-homeassistant-custom-component 0.13.367, ruff 0.16.9 and mypy 2.3.1. uv.lock pins the full tree.
Layout#
| File | Purpose |
|---|---|
__init__.py | Entry setup, unload, entry migration and action registration. |
parser.py | Decodes one advert. No Home Assistant imports. |
attribution.py | Chooses a person by weight. No Home Assistant imports. |
body_metrics.py | Body-composition equations. No Home Assistant imports. |
coordinator.py | One per scale: Bluetooth callback, settling buffer, pending measurements, notifications. |
people.py | The people hub: profiles, weight history and per-person state. |
migration.py | Moves people from scale entries to the People entry. |
store.py | Persists history and pending measurements. |
config_flow.py | Setup, the People menu and the scale's people list. |
repairs.py | The fix flow of the unknown-weight repair. |
sensor.py, binary_sensor.py, button.py, select.py | Platforms. |
diagnostics.py | Diagnostics with redaction. |
strings.json, translations/en.json | All user-facing strings. tests/test_translations.py checks that the two match. |
Documentation#
The pages are Markdown in docs-src. jupiter-docs from belikh/docs generates docs/*.md and the site from them. Edit docs-src only.
git clone https://github.com/belikh/docs .jupiter-docs
(cd .jupiter-docs && npm ci && npm run update:design)
export JUPITER_DESIGN_DIR="$PWD/.jupiter-docs/vendor/design"
node .jupiter-docs/packages/docs/bin/jupiter-docs.mjs check
node .jupiter-docs/packages/docs/bin/jupiter-docs.mjs buildCommit docs-src and the regenerated docs together. .jupiter-docs and dist are in .gitignore.
Workflows#
| Workflow | Runs on | Checks |
|---|---|---|
tests.yaml | push to main, pull request | pytest, ruff check, ruff format, mypy. |
docs.yaml | push to main and pull request that touch the pages | jupiter-docs check, build --check and the site build. |
hassfest.yaml | push to main, pull request, daily | Home Assistant manifest and translation rules. |
hacs.yaml | push to main, pull request, daily | HACS repository rules. |
release.yaml | tag push | Creates the GitHub release. |