Skip to content

Commit e602404

Browse files
authored
Merge pull request #9 from graphras-com/refactor/rename-to-haclient-src-layout
refactor: rename ha_client to haclient with src/ layout
2 parents 2fbcec0 + e4a0add commit e602404

47 files changed

Lines changed: 94 additions & 94 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ jobs:
6767
with:
6868
python-versions: ${{ vars.CI_PYTHON_TEST_VERSIONS || '["3.11","3.12"]' }}
6969
install-spec: ${{ vars.CI_PYTHON_INSTALL_SPEC || '.[dev]' }}
70-
coverage-target: ${{ vars.CI_PYTHON_COVERAGE_TARGET || 'ha_client' }}
70+
coverage-target: ${{ vars.CI_PYTHON_COVERAGE_TARGET || 'haclient' }}
7171
coverage-threshold: ${{ fromJSON(vars.CI_PYTHON_COVERAGE_THRESHOLD || '95') }}
7272

7373
# ── Security ──────────────────────────────────────────────────────

AGENTS.md

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,11 @@ Every change MUST include **all** of the following:
2727

2828
- [ ] **Tests** — new or updated tests covering the change with **≥ 95% coverage** for affected modules. Verify with:
2929
```bash
30-
pytest --cov=ha_client --cov-report=term-missing --cov-fail-under=95
30+
pytest --cov=haclient --cov-report=term-missing --cov-fail-under=95
3131
```
3232
- [ ] **Documentation** — update relevant files in `docs/` to reflect the change (new features get a new or updated doc page).
3333
- [ ] **README.md** — update the project README if the change affects public API, installation, usage examples, or feature list.
34-
- [ ] **Lint & type-check pass**`ruff check .` and `mypy ha_client/` must be clean.
34+
- [ ] **Lint & type-check pass**`ruff check .` and `mypy src/haclient/` must be clean.
3535

3636
## Setup
3737

@@ -49,10 +49,10 @@ Python 3.11+ required (`.python-version` pins 3.11).
4949
ruff check .
5050

5151
# Type-check (strict mode)
52-
mypy ha_client/
52+
mypy src/haclient/
5353

5454
# Tests with coverage (target ≥95%)
55-
pytest --cov=ha_client --cov-report=term-missing --cov-fail-under=95
55+
pytest --cov=haclient --cov-report=term-missing --cov-fail-under=95
5656

5757
# Single test file
5858
pytest tests/test_client.py
@@ -61,17 +61,17 @@ pytest tests/test_client.py
6161
pytest tests/test_client.py::test_name -x
6262
```
6363

64-
Run order: `ruff check .``mypy ha_client/``pytest`
64+
Run order: `ruff check .``mypy src/haclient/``pytest`
6565

6666
## Architecture
6767

68-
- `ha_client/client.py``HAClient`, the main async facade (REST + WebSocket)
69-
- `ha_client/websocket.py` — low-level WS with auth, keepalive, auto-reconnect
70-
- `ha_client/rest.py` — REST API client
71-
- `ha_client/registry.py` — entity registry (state tracking)
72-
- `ha_client/entity.py` — base `Entity` with state-change dispatch
73-
- `ha_client/sync.py``SyncHAClient`, blocking wrapper running event loop in background thread
74-
- `ha_client/domains/` — domain entity classes (`MediaPlayer`, `Light`, `Switch`, `Climate`, `Cover`, `Sensor`, `BinarySensor`)
68+
- `src/haclient/client.py``HAClient`, the main async facade (REST + WebSocket)
69+
- `src/haclient/websocket.py` — low-level WS with auth, keepalive, auto-reconnect
70+
- `src/haclient/rest.py` — REST API client
71+
- `src/haclient/registry.py` — entity registry (state tracking)
72+
- `src/haclient/entity.py` — base `Entity` with state-change dispatch
73+
- `src/haclient/sync.py``SyncHAClient`, blocking wrapper running event loop in background thread
74+
- `src/haclient/domains/` — domain entity classes (`MediaPlayer`, `Light`, `Switch`, `Climate`, `Cover`, `Sensor`, `BinarySensor`)
7575

7676
## Testing
7777

@@ -83,5 +83,5 @@ Run order: `ruff check .` → `mypy ha_client/` → `pytest`
8383

8484
- Ruff line length: 100
8585
- Ruff rules: E, W, F, I (isort), B (bugbear, B008 ignored), UP, C4, SIM
86-
- mypy strict mode on `ha_client/`; tests are exempt from `disallow_untyped_defs`
86+
- mypy strict mode on `src/haclient/`; tests are exempt from `disallow_untyped_defs`
8787
- Build backend: hatchling

README.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# ha-client
1+
# HaClient
22

33
An async-first, high-level Python client for [Home Assistant](https://www.home-assistant.io/).
44
It talks to a Home Assistant instance over both the WebSocket API (for live
@@ -31,7 +31,7 @@ async with HAClient("http://homeassistant.local:8123", token=TOKEN) as ha:
3131
## Installation
3232

3333
```bash
34-
pip install ha-client
34+
pip install haclient
3535
```
3636

3737
From source (with dev extras):
@@ -44,7 +44,7 @@ uv pip install -e ".[dev]"
4444

4545
```python
4646
import asyncio
47-
from ha_client import HAClient
47+
from haclient import HAClient
4848

4949

5050
async def main() -> None:
@@ -171,7 +171,7 @@ recursively descends into expandable nodes and returns a flat list of
171171
### Synchronous wrapper
172172

173173
```python
174-
from ha_client import SyncHAClient
174+
from haclient import SyncHAClient
175175

176176
with SyncHAClient("http://homeassistant.local:8123", token=TOKEN) as ha:
177177
player = ha.media_player("livingroom")
@@ -203,7 +203,7 @@ re-established transparently.
203203
## Project layout
204204

205205
```
206-
ha_client/
206+
src/haclient/
207207
__init__.py
208208
client.py # HAClient (high-level facade)
209209
websocket.py # WebSocketClient (low-level WS + reconnect)
@@ -233,16 +233,16 @@ source .venv/bin/activate
233233
uv pip install -e ".[dev]"
234234

235235
# Run the full test suite with coverage (target: ≥ 90 %).
236-
pytest --cov=ha_client --cov-report=term-missing
236+
pytest --cov=haclient --cov-report=term-missing
237237

238238
# Lint and type-check.
239239
ruff check .
240-
mypy ha_client/
240+
mypy src/haclient/
241241
```
242242

243243
## Acknowledgements
244244

245-
ha-client is built on top of excellent open-source software. See
245+
HaClient is built on top of excellent open-source software. See
246246
[THIRD_PARTY_NOTICES.md](THIRD_PARTY_NOTICES.md) for the full list of
247247
third-party dependencies and their licenses.
248248

THIRD_PARTY_NOTICES.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Third-Party Notices
22

3-
ha-client uses the following third-party libraries. Each is listed with its
3+
HaClient uses the following third-party libraries. Each is listed with its
44
license type and project URL.
55

66
## Runtime Dependencies

docs/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# HAClient Documentation
22

3-
API reference for `ha_client` — an async-first Python client for Home Assistant.
3+
API reference for `haclient` — an async-first Python client for Home Assistant.
44

55
## Core Library
66

docs/base.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Base Library
22

3-
## `ha_client.client.HAClient`
3+
## `haclient.client.HAClient`
44

55
High-level orchestrator combining REST and WebSocket clients.
66

@@ -61,7 +61,7 @@ async with HAClient(url, token) as client:
6161

6262
---
6363

64-
## `ha_client.sync.SyncHAClient`
64+
## `haclient.sync.SyncHAClient`
6565

6666
Blocking wrapper around `HAClient`. Runs a dedicated event loop in a background thread.
6767

@@ -89,7 +89,7 @@ with SyncHAClient(url, token) as client:
8989

9090
---
9191

92-
## `ha_client.rest.RestClient`
92+
## `haclient.rest.RestClient`
9393

9494
HTTP REST API client.
9595

@@ -118,7 +118,7 @@ RestClient(
118118

119119
---
120120

121-
## `ha_client.websocket.WebSocketClient`
121+
## `haclient.websocket.WebSocketClient`
122122

123123
WebSocket API client with auto-reconnect.
124124

@@ -163,7 +163,7 @@ EventHandler = Callable[[dict[str, Any]], Awaitable[None] | None]
163163

164164
---
165165

166-
## `ha_client.entity.Entity`
166+
## `haclient.entity.Entity`
167167

168168
Base class for all domain entities.
169169

@@ -215,7 +215,7 @@ ValueChangeHandler = Callable[[Any, Any], Any]
215215

216216
---
217217

218-
## `ha_client.registry.EntityRegistry`
218+
## `haclient.registry.EntityRegistry`
219219

220220
Entity store with lookup and domain filtering.
221221

@@ -235,7 +235,7 @@ Supports `__contains__`, `__iter__`, `__len__`.
235235

236236
---
237237

238-
## `ha_client.exceptions`
238+
## `haclient.exceptions`
239239

240240
| Exception | Base | Description |
241241
|---|---|---|

docs/binary_sensor.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
# Binary Sensor
22

3-
`ha_client.domains.binary_sensor.BinarySensor` — domain: `"binary_sensor"`
3+
`haclient.domains.binary_sensor.BinarySensor` — domain: `"binary_sensor"`
44

5-
Inherits from [`Entity`](base.md#ha_cliententityentity). Read-only.
5+
Inherits from [`Entity`](base.md#hacliententityentity). Read-only.
66

77
## Properties
88

docs/climate.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
# Climate
22

3-
`ha_client.domains.climate.Climate` — domain: `"climate"`
3+
`haclient.domains.climate.Climate` — domain: `"climate"`
44

5-
Inherits from [`Entity`](base.md#ha_cliententityentity).
5+
Inherits from [`Entity`](base.md#hacliententityentity).
66

77
## Properties
88

docs/cover.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
# Cover
22

3-
`ha_client.domains.cover.Cover` — domain: `"cover"`
3+
`haclient.domains.cover.Cover` — domain: `"cover"`
44

5-
Inherits from [`Entity`](base.md#ha_cliententityentity).
5+
Inherits from [`Entity`](base.md#hacliententityentity).
66

77
## Properties
88

docs/light.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
# Light
22

3-
`ha_client.domains.light.Light` — domain: `"light"`
3+
`haclient.domains.light.Light` — domain: `"light"`
44

5-
Inherits from [`Entity`](base.md#ha_cliententityentity).
5+
Inherits from [`Entity`](base.md#hacliententityentity).
66

77
## Properties
88

0 commit comments

Comments
 (0)