From 7d76bd87404df18745d8ee702ffeeb7e76bc2041 Mon Sep 17 00:00:00 2001 From: Marc Mueller <30130371+cdce8p@users.noreply.github.com> Date: Sun, 7 Apr 2024 00:45:22 +0200 Subject: [PATCH] Add blog post for deprecated backports and typing aliases (#2139) Co-authored-by: J. Nick Koston --- ...deprecated-backports-and-typing-aliases.md | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 blog/2024-04-08-deprecated-backports-and-typing-aliases.md diff --git a/blog/2024-04-08-deprecated-backports-and-typing-aliases.md b/blog/2024-04-08-deprecated-backports-and-typing-aliases.md new file mode 100644 index 00000000..f1f342cc --- /dev/null +++ b/blog/2024-04-08-deprecated-backports-and-typing-aliases.md @@ -0,0 +1,21 @@ +--- +author: Marc Mueller +authorURL: https://github.com/cdce8p +title: "Deprecate old backports and typing alias" +--- + +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. + +| Deprecated | Replacement | Python version | +| ---------- | ----------- | -------------- | +| `homeassistant.backports.enum.StrEnum` | `enum.StrEnum` | >= 3.11 | +| `homeassistant.backports.functools.cached_property` | `functools.cached_property` | >= 3.8, >= 3.12 (performance improvement) | + +In addition, some typing aliases are also deprecated now. + +| Deprecated | Replacement | +| ---------- | ----------- | +| `homeassistant.helpers.typing.ContextType` | `homeassistant.core.Context` | +| `homeassistant.helpers.typing.EventType` | `homeassistant.core.Event` | +| `homeassistant.helpers.typing.HomeAssistantType` | `homeassistant.core.HomeAssistant` | +| `homeassistant.helpers.typing.ServiceCallType` | `homeassistant.core.ServiceCall` |