Skip to content

v0.18.0.dev1

Pre-release
Pre-release

Choose a tag to compare

@NodeJSmith NodeJSmith released this 13 Dec 18:00
· 87 commits to main since this release
7628d1c

[0.18.0.dev1] - 2025-12-13

Changed

  • Allow Python 3.11 and 3.12 again!
  • Breaking: All events now contain untyped payloads instead of typed ones
    • StateChangeEvent is now RawStateChangeEvent
    • There is a new DI handler for TypedStateChangeEvent to handle conversion if desired
  • Breaking: State conversion system now uses dynamic registry instead of hardcoded unions
    • StateUnion type has been removed - use BaseState in type hints instead
    • DomainLiteral type has been removed - no longer needed with dynamic registration
    • State classes automatically register their domains via __init_subclass__ hook
  • Breaking: try_convert_state now typed to return BaseState | None instead of StateUnion | None
    • Uses registry lookup instead of Pydantic discriminated unions for conversion
    • Falls back to BaseState for unknown/custom domains
    • try_convert_state moved to hassette.state_registry module
    • states.__init__ now only imports/exports classes, no conversion logic
  • Improved dependency injection system for event handlers, including support for optional dependencies via Maybe* annotations
  • Renamed states.py to state_manager.py (and renamed the class) to avoid confusion with models/states module
  • Removed defaults from StateT and StateValueT type vars
  • Removed type constraints from StateValueT type var to allow custom types to be used
  • Moved accessors, conditions, dependencies, and predicates all to hassette.event_handling for consistency
  • Moved DI extraction and injection modules to hassette.bus

Added

  • TypeRegistry class for handling simple value conversion (e.g. converting "off" to False)
  • Handling of Union types
  • Handling of None types
  • Handling of type conversion for custom Annotated DI handlers

Removed

  • Breaking: Removed StateUnion type - replaced with BaseState throughout codebase
  • Breaking: Removed DomainLiteral type - no longer needed with registry system
  • Breaking: Removed manual _StateUnion type definition from states module
  • Breaking: Removed StateValueOld/New, StateValueOldNew, StateOldNew, MaybeStateOldNew, AttrOld, AttrNew, AttrOldNew DI handlers
    • These can be used still by annotating with Annotated[<type>, A.<function>] using provided accessors module
    • They were too difficult to maintain/type properly across the framework

Full Changelog: v0.17.0...v0.18.0.dev1