Skip to main content

Deprecate old backports and typing alias

· One min read

In the past, we've backported features from upstream CPython to use them early and improve user and developers' experience. Home Assistant only supports Python 3.12, so these can be used directly from Python. These backports are now deprecated and will be removed in the future.

DeprecatedReplacementPython version
homeassistant.backports.enum.StrEnumenum.StrEnum>= 3.11
homeassistant.backports.functools.cached_propertyfunctools.cached_property>= 3.8, >= 3.12 (performance improvement)

In addition, some typing aliases are also deprecated now.

DeprecatedReplacement
homeassistant.helpers.typing.ContextTypehomeassistant.core.Context
homeassistant.helpers.typing.EventTypehomeassistant.core.Event
homeassistant.helpers.typing.HomeAssistantTypehomeassistant.core.HomeAssistant
homeassistant.helpers.typing.ServiceCallTypehomeassistant.core.ServiceCall