V6 rewrite#232
Merged
Merged
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## dev #232 +/- ##
==========================================
+ Coverage 99.66% 99.85% +0.19%
==========================================
Files 29 29
Lines 2359 2787 +428
==========================================
+ Hits 2351 2783 +432
+ Misses 8 4 -4 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Swap type checker from mypy to zuban across CI, pre-commit, and pyproject.toml. Relax pinned versions on docs, styling, and testing dependency groups to use range constraints. Bump requires-python to >=3.10 and websockets to >=16.
Remove the unified Client/WebsocketClient classes that combined sync and async via use_async flag. Promote the Raw* implementations to be the public API: Client, AsyncClient, WebsocketClient, AsyncWebsocketClient. Drop the async_ prefix from async client methods since they now live on separate classes. Move URL scheme validation into base classes.
Introduce Base*/Async* model variants for Domain, Entity, Group, Service, and Event. Replace _client constructor pattern with explicit client field. Bump minimum Python to 3.11, expand ruff rules to ALL, modernize type annotations, and enforce single-line imports.
Replace the decorator-based processor registry with dict-based MIME dispatch and separate sync/async entry points. Response content is now read lazily only when needed for error messages, eliminating the internal _buffer access hack. Remove custom processor registration API and decode_bytes parameter.
- Rename get_domain() param from `domain` to `domain_id` on WS clients - Change WS get_domain() return type to Domain | None using .get() - Fix fire_event() return type on sync Client from str | None to str - Add keyword-only marker for significant_changes_only in sync get_entity_histories() - Remove redundant entity_id param from WS trigger_service methods - Fix TemplateEvent.result type from str to Any (HA returns native types) - Add str() conversion in WS get_rendered_template to match return annotation - Document WS trigger_service return type differences (protocol limitation)
New models for entity registry responses (EntityRegistryEntry, EntityRegistryEntryExtended, EntityRegistryUpdateResult) and list/get/update/remove methods on both sync and async WS clients. Also adds configurable max_size param to WS client init (default 16MB) to handle large responses like full entity registry lists. Update CI Python version from 3.9 to 3.11.
- Rewrite usage.rst async section: replace use_async=True/async_ prefix pattern with separate AsyncClient and AsyncWebsocketClient classes - Fix advanced.rst: update caching params (cache_session -> session), remove obsolete "disabling caching" section, add use_cache docs - Fix README.md: update async example to use AsyncClient, remove "async not supported" note for WebSocket - Standardize docstrings across all four client classes: consistent voice, correct class references (Entity->AsyncEntity etc.), fix "homeassistant" -> "Home Assistant" naming - Fix minor issues: typos, Python version (3.9->3.11), zuban in CONTRIBUTING.rst tooling list
- Fix broken f-string/%-style log format in sync client - Align empty-params guard between sync and async clients - Replace deprecated verify_ssl with ssl param in TCPConnector - Stop prepare_headers from mutating caller's dict; allow header overrides - Use ResponseError instead of mismatched RequestError in WebSocket layer - Fix auth failure path that could raise unhandled ValidationError - Make sync _subscribe_events use recv_result to match async - Make include_id keyword-only in async send() to match sync - Gracefully handle __exit__ when connection is already closed - Clean up _event_responses in finally block during unsubscribe - Suppress auth token from debug logging - Validate History states are non-empty and share same entity_id - Replace asyncio.Task and Container with deserializable types in models - Add model_rebuild for ServiceFieldSelector circular reference - Export all config entry and entity registry models from top-level package - Fix async websocket fixture decorator in conftest - Fix sync test_listen_config_entries to use explicit break like async version - Strengthen test assertions and add cleanup safety in disable/enable tests - Use tmp_path for SQLite cache in async session test
- Raise ReceivingError in __exit__/__aexit__ when connection is not open - Remove duplicate check_success from handle_recv (parse_response already handles errors) - Catch non-ValidationError exceptions in authentication_phase - Add ResponseError to Service.trigger() fallback so it works for websocket clients - Fix tests to expect ResponseError for websocket error responses
Replace all HTTP and WebSocket dependencies with niquests: - requests + requests-cache -> niquests (sync REST client) - aiohttp + aiohttp-client-cache -> niquests AsyncSession (async REST client) - websockets -> niquests[ws] WebSocket extension (sync + async WS clients) Drop built-in request caching support (requests-cache, aiohttp-client-cache). Users can configure caching on their own session instances if needed. WebSocket clients now use niquests' response extension API (Session.get(ws://) -> response.extension.send_payload/next_payload). Add fragment buffering in _recv to work around upstream urllib3-future bug where next_payload() returns incomplete messages for large payloads. Accept optional session parameter in WebSocket client constructors for consistency with REST clients. Use non-nullable session types with del for _ws in __exit__/__aexit__.
GrandMoff100
reviewed
Apr 8, 2026
GrandMoff100
reviewed
Apr 9, 2026
…[tool.zuban] with default mode, and fix test type narrowing
GrandMoff100
previously approved these changes
Apr 12, 2026
…ches, and self-contained entity registry remove tests
GrandMoff100
approved these changes
Apr 26, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #229