mirror of
https://github.com/home-assistant/core.git
synced 2025-07-20 03:37:07 +00:00
Deprecate Python 3.9 (#82193)
This commit is contained in:
parent
f87ef742e8
commit
6a1bb8c421
@ -17,7 +17,7 @@ import voluptuous as vol
|
||||
import yarl
|
||||
|
||||
from . import config as conf_util, config_entries, core, loader
|
||||
from .components import http, persistent_notification
|
||||
from .components import http
|
||||
from .const import (
|
||||
REQUIRED_NEXT_PYTHON_HA_RELEASE,
|
||||
REQUIRED_NEXT_PYTHON_VER,
|
||||
@ -268,16 +268,31 @@ async def async_from_config_dict(
|
||||
REQUIRED_NEXT_PYTHON_HA_RELEASE
|
||||
and sys.version_info[:3] < REQUIRED_NEXT_PYTHON_VER
|
||||
):
|
||||
msg = (
|
||||
"Support for the running Python version "
|
||||
f"{'.'.join(str(x) for x in sys.version_info[:3])} is deprecated and will "
|
||||
f"be removed in Home Assistant {REQUIRED_NEXT_PYTHON_HA_RELEASE}. "
|
||||
"Please upgrade Python to "
|
||||
f"{'.'.join(str(x) for x in REQUIRED_NEXT_PYTHON_VER[:2])}."
|
||||
current_python_version = ".".join(str(x) for x in sys.version_info[:3])
|
||||
required_python_version = ".".join(str(x) for x in REQUIRED_NEXT_PYTHON_VER[:2])
|
||||
_LOGGER.warning(
|
||||
(
|
||||
"Support for the running Python version %s is deprecated and "
|
||||
"will be removed in Home Assistant %s; "
|
||||
"Please upgrade Python to %s"
|
||||
),
|
||||
current_python_version,
|
||||
REQUIRED_NEXT_PYTHON_HA_RELEASE,
|
||||
required_python_version,
|
||||
)
|
||||
_LOGGER.warning(msg)
|
||||
persistent_notification.async_create(
|
||||
hass, msg, "Python version", "python_version"
|
||||
issue_registry.async_create_issue(
|
||||
hass,
|
||||
core.DOMAIN,
|
||||
"python_version",
|
||||
is_fixable=False,
|
||||
severity=issue_registry.IssueSeverity.WARNING,
|
||||
breaks_in_ha_version=REQUIRED_NEXT_PYTHON_HA_RELEASE,
|
||||
translation_key="python_version",
|
||||
translation_placeholders={
|
||||
"current_python_version": current_python_version,
|
||||
"required_python_version": required_python_version,
|
||||
"breaks_in_ha_version": REQUIRED_NEXT_PYTHON_HA_RELEASE,
|
||||
},
|
||||
)
|
||||
|
||||
return hass
|
||||
|
@ -3,6 +3,10 @@
|
||||
"historic_currency": {
|
||||
"title": "The configured currency is no longer in use",
|
||||
"description": "The currency {currency} is no longer in use, please reconfigure the currency configuration."
|
||||
},
|
||||
"python_version": {
|
||||
"title": "Support for Python {current_python_version} is being removed",
|
||||
"description": "Support for running Home Assistant in the current used Python version {current_python_version} is deprecated and will be removed in Home Assistant {breaks_in_ha_version}. Please upgrade Python to {required_python_version} to prevent your Home Assistant instance from breaking."
|
||||
}
|
||||
},
|
||||
"system_health": {
|
||||
|
@ -3,6 +3,10 @@
|
||||
"historic_currency": {
|
||||
"description": "The currency {currency} is no longer in use, please reconfigure the currency configuration.",
|
||||
"title": "The configured currency is no longer in use"
|
||||
},
|
||||
"python_version": {
|
||||
"description": "Support for running Home Assistant in the current used Python version {current_python_version} is deprecated and will be removed in Home Assistant {breaks_in_ha_version}. Please upgrade Python to {required_python_version} to prevent your Home Assistant instance from breaking.",
|
||||
"title": "Support for Python {current_python_version} is being removed"
|
||||
}
|
||||
},
|
||||
"system_health": {
|
||||
|
@ -12,9 +12,9 @@ PATCH_VERSION: Final = "0.dev0"
|
||||
__short_version__: Final = f"{MAJOR_VERSION}.{MINOR_VERSION}"
|
||||
__version__: Final = f"{__short_version__}.{PATCH_VERSION}"
|
||||
REQUIRED_PYTHON_VER: Final[tuple[int, int, int]] = (3, 9, 0)
|
||||
REQUIRED_NEXT_PYTHON_VER: Final[tuple[int, int, int]] = (3, 9, 0)
|
||||
REQUIRED_NEXT_PYTHON_VER: Final[tuple[int, int, int]] = (3, 10, 0)
|
||||
# Truthy date string triggers showing related deprecation warning messages.
|
||||
REQUIRED_NEXT_PYTHON_HA_RELEASE: Final = ""
|
||||
REQUIRED_NEXT_PYTHON_HA_RELEASE: Final = "2023.2"
|
||||
|
||||
# Format for platform files
|
||||
PLATFORM_FORMAT: Final = "{platform}.{domain}"
|
||||
|
@ -32,7 +32,8 @@ SUPPORTED_PYTHON_TUPLES = [
|
||||
]
|
||||
if REQUIRED_PYTHON_VER[0] == REQUIRED_NEXT_PYTHON_VER[0]:
|
||||
for minor in range(REQUIRED_PYTHON_VER[1] + 1, REQUIRED_NEXT_PYTHON_VER[1] + 1):
|
||||
SUPPORTED_PYTHON_TUPLES.append((REQUIRED_PYTHON_VER[0], minor))
|
||||
if minor < 10: # stdlib list does not support 3.10+
|
||||
SUPPORTED_PYTHON_TUPLES.append((REQUIRED_PYTHON_VER[0], minor))
|
||||
SUPPORTED_PYTHON_VERSIONS = [
|
||||
".".join(map(str, version_tuple)) for version_tuple in SUPPORTED_PYTHON_TUPLES
|
||||
]
|
||||
|
Loading…
x
Reference in New Issue
Block a user