mirror of
https://github.com/home-assistant/core.git
synced 2025-07-24 21:57:51 +00:00
Drop Python 3.9 support (#85456)
This commit is contained in:
parent
7661b222b4
commit
5102d1a5f3
2
.github/workflows/builder.yml
vendored
2
.github/workflows/builder.yml
vendored
@ -10,7 +10,7 @@ on:
|
|||||||
|
|
||||||
env:
|
env:
|
||||||
BUILD_TYPE: core
|
BUILD_TYPE: core
|
||||||
DEFAULT_PYTHON: 3.9
|
DEFAULT_PYTHON: "3.10"
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
init:
|
init:
|
||||||
|
4
.github/workflows/ci.yaml
vendored
4
.github/workflows/ci.yaml
vendored
@ -31,8 +31,8 @@ env:
|
|||||||
CACHE_VERSION: 3
|
CACHE_VERSION: 3
|
||||||
PIP_CACHE_VERSION: 3
|
PIP_CACHE_VERSION: 3
|
||||||
HA_SHORT_VERSION: 2023.2
|
HA_SHORT_VERSION: 2023.2
|
||||||
DEFAULT_PYTHON: 3.9
|
DEFAULT_PYTHON: "3.10"
|
||||||
ALL_PYTHON_VERSIONS: "['3.9', '3.10']"
|
ALL_PYTHON_VERSIONS: "['3.10']"
|
||||||
PRE_COMMIT_CACHE: ~/.cache/pre-commit
|
PRE_COMMIT_CACHE: ~/.cache/pre-commit
|
||||||
PIP_CACHE: /tmp/pip-cache
|
PIP_CACHE: /tmp/pip-cache
|
||||||
SQLALCHEMY_WARN_20: 1
|
SQLALCHEMY_WARN_20: 1
|
||||||
|
2
.github/workflows/translations.yaml
vendored
2
.github/workflows/translations.yaml
vendored
@ -12,7 +12,7 @@ on:
|
|||||||
- "**strings.json"
|
- "**strings.json"
|
||||||
|
|
||||||
env:
|
env:
|
||||||
DEFAULT_PYTHON: 3.9
|
DEFAULT_PYTHON: "3.10"
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
upload:
|
upload:
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
FROM mcr.microsoft.com/vscode/devcontainers/python:0-3.9
|
FROM mcr.microsoft.com/vscode/devcontainers/python:0-3.10
|
||||||
|
|
||||||
SHELL ["/bin/bash", "-o", "pipefail", "-c"]
|
SHELL ["/bin/bash", "-o", "pipefail", "-c"]
|
||||||
|
|
||||||
|
@ -60,7 +60,7 @@ class LircInterface(threading.Thread):
|
|||||||
def run(self):
|
def run(self):
|
||||||
"""Run the loop of the LIRC interface thread."""
|
"""Run the loop of the LIRC interface thread."""
|
||||||
_LOGGER.debug("LIRC interface thread started")
|
_LOGGER.debug("LIRC interface thread started")
|
||||||
while not self.stopped.isSet():
|
while not self.stopped.is_set():
|
||||||
try:
|
try:
|
||||||
code = lirc.nextcode() # list; empty if no buttons pressed
|
code = lirc.nextcode() # list; empty if no buttons pressed
|
||||||
except lirc.NextCodeError:
|
except lirc.NextCodeError:
|
||||||
|
@ -32,12 +32,12 @@ async def _async_call_or_raise_not_ready(
|
|||||||
except RadiothermTstatError as ex:
|
except RadiothermTstatError as ex:
|
||||||
msg = f"{host} was busy (invalid value returned): {ex}"
|
msg = f"{host} was busy (invalid value returned): {ex}"
|
||||||
raise ConfigEntryNotReady(msg) from ex
|
raise ConfigEntryNotReady(msg) from ex
|
||||||
except (OSError, URLError) as ex:
|
|
||||||
msg = f"{host} connection error: {ex}"
|
|
||||||
raise ConfigEntryNotReady(msg) from ex
|
|
||||||
except timeout as ex:
|
except timeout as ex:
|
||||||
msg = f"{host} timed out waiting for a response: {ex}"
|
msg = f"{host} timed out waiting for a response: {ex}"
|
||||||
raise ConfigEntryNotReady(msg) from ex
|
raise ConfigEntryNotReady(msg) from ex
|
||||||
|
except (OSError, URLError) as ex:
|
||||||
|
msg = f"{host} connection error: {ex}"
|
||||||
|
raise ConfigEntryNotReady(msg) from ex
|
||||||
|
|
||||||
|
|
||||||
async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
|
async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
|
||||||
|
@ -39,9 +39,9 @@ class RadioThermUpdateCoordinator(DataUpdateCoordinator[RadioThermUpdate]):
|
|||||||
except RadiothermTstatError as ex:
|
except RadiothermTstatError as ex:
|
||||||
msg = f"{self._description} was busy (invalid value returned): {ex}"
|
msg = f"{self._description} was busy (invalid value returned): {ex}"
|
||||||
raise UpdateFailed(msg) from ex
|
raise UpdateFailed(msg) from ex
|
||||||
except (OSError, URLError) as ex:
|
|
||||||
msg = f"{self._description} connection error: {ex}"
|
|
||||||
raise UpdateFailed(msg) from ex
|
|
||||||
except timeout as ex:
|
except timeout as ex:
|
||||||
msg = f"{self._description}) timed out waiting for a response: {ex}"
|
msg = f"{self._description}) timed out waiting for a response: {ex}"
|
||||||
raise UpdateFailed(msg) from ex
|
raise UpdateFailed(msg) from ex
|
||||||
|
except (OSError, URLError) as ex:
|
||||||
|
msg = f"{self._description} connection error: {ex}"
|
||||||
|
raise UpdateFailed(msg) from ex
|
||||||
|
@ -57,6 +57,8 @@ class WebSocketAdapter(logging.LoggerAdapter):
|
|||||||
|
|
||||||
def process(self, msg: str, kwargs: Any) -> tuple[str, Any]:
|
def process(self, msg: str, kwargs: Any) -> tuple[str, Any]:
|
||||||
"""Add connid to websocket log messages."""
|
"""Add connid to websocket log messages."""
|
||||||
|
if not self.extra or "connid" not in self.extra:
|
||||||
|
return msg, kwargs
|
||||||
return f'[{self.extra["connid"]}] {msg}', kwargs
|
return f'[{self.extra["connid"]}] {msg}', kwargs
|
||||||
|
|
||||||
|
|
||||||
|
@ -11,10 +11,10 @@ MINOR_VERSION: Final = 2
|
|||||||
PATCH_VERSION: Final = "0.dev0"
|
PATCH_VERSION: Final = "0.dev0"
|
||||||
__short_version__: Final = f"{MAJOR_VERSION}.{MINOR_VERSION}"
|
__short_version__: Final = f"{MAJOR_VERSION}.{MINOR_VERSION}"
|
||||||
__version__: Final = f"{__short_version__}.{PATCH_VERSION}"
|
__version__: Final = f"{__short_version__}.{PATCH_VERSION}"
|
||||||
REQUIRED_PYTHON_VER: Final[tuple[int, int, int]] = (3, 9, 0)
|
REQUIRED_PYTHON_VER: Final[tuple[int, int, int]] = (3, 10, 0)
|
||||||
REQUIRED_NEXT_PYTHON_VER: Final[tuple[int, int, int]] = (3, 10, 0)
|
REQUIRED_NEXT_PYTHON_VER: Final[tuple[int, int, int]] = (3, 10, 0)
|
||||||
# Truthy date string triggers showing related deprecation warning messages.
|
# Truthy date string triggers showing related deprecation warning messages.
|
||||||
REQUIRED_NEXT_PYTHON_HA_RELEASE: Final = "2023.2"
|
REQUIRED_NEXT_PYTHON_HA_RELEASE: Final = ""
|
||||||
|
|
||||||
# Format for platform files
|
# Format for platform files
|
||||||
PLATFORM_FORMAT: Final = "{platform}.{domain}"
|
PLATFORM_FORMAT: Final = "{platform}.{domain}"
|
||||||
|
2
mypy.ini
2
mypy.ini
@ -3,7 +3,7 @@
|
|||||||
# To update, run python3 -m script.hassfest -p mypy_config
|
# To update, run python3 -m script.hassfest -p mypy_config
|
||||||
|
|
||||||
[mypy]
|
[mypy]
|
||||||
python_version = 3.9
|
python_version = 3.10
|
||||||
show_error_codes = true
|
show_error_codes = true
|
||||||
follow_imports = silent
|
follow_imports = silent
|
||||||
ignore_missing_imports = true
|
ignore_missing_imports = true
|
||||||
|
@ -18,11 +18,10 @@ classifiers = [
|
|||||||
"Intended Audience :: Developers",
|
"Intended Audience :: Developers",
|
||||||
"License :: OSI Approved :: Apache Software License",
|
"License :: OSI Approved :: Apache Software License",
|
||||||
"Operating System :: OS Independent",
|
"Operating System :: OS Independent",
|
||||||
"Programming Language :: Python :: 3.9",
|
|
||||||
"Programming Language :: Python :: 3.10",
|
"Programming Language :: Python :: 3.10",
|
||||||
"Topic :: Home Automation",
|
"Topic :: Home Automation",
|
||||||
]
|
]
|
||||||
requires-python = ">=3.9.0"
|
requires-python = ">=3.10.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"aiohttp==3.8.1",
|
"aiohttp==3.8.1",
|
||||||
"astral==2.2",
|
"astral==2.2",
|
||||||
|
@ -30,7 +30,6 @@ pytest-xdist==2.5.0
|
|||||||
pytest==7.2.1
|
pytest==7.2.1
|
||||||
requests_mock==1.10.0
|
requests_mock==1.10.0
|
||||||
respx==0.20.1
|
respx==0.20.1
|
||||||
stdlib-list==0.7.0
|
|
||||||
tomli==2.0.1;python_version<"3.11"
|
tomli==2.0.1;python_version<"3.11"
|
||||||
tqdm==4.64.0
|
tqdm==4.64.0
|
||||||
types-atomicwrites==1.4.1
|
types-atomicwrites==1.4.1
|
||||||
|
@ -11,10 +11,8 @@ import sys
|
|||||||
from typing import Any
|
from typing import Any
|
||||||
|
|
||||||
from awesomeversion import AwesomeVersion, AwesomeVersionStrategy
|
from awesomeversion import AwesomeVersion, AwesomeVersionStrategy
|
||||||
from stdlib_list import stdlib_list
|
|
||||||
from tqdm import tqdm
|
from tqdm import tqdm
|
||||||
|
|
||||||
from homeassistant.const import REQUIRED_NEXT_PYTHON_VER, REQUIRED_PYTHON_VER
|
|
||||||
import homeassistant.util.package as pkg_util
|
import homeassistant.util.package as pkg_util
|
||||||
from script.gen_requirements_all import COMMENT_REQUIREMENTS, normalize_package_name
|
from script.gen_requirements_all import COMMENT_REQUIREMENTS, normalize_package_name
|
||||||
|
|
||||||
@ -28,17 +26,6 @@ PACKAGE_REGEX = re.compile(
|
|||||||
)
|
)
|
||||||
PIP_REGEX = re.compile(r"^(--.+\s)?([-_\.\w\d]+.*(?:==|>=|<=|~=|!=|<|>|===)?.*$)")
|
PIP_REGEX = re.compile(r"^(--.+\s)?([-_\.\w\d]+.*(?:==|>=|<=|~=|!=|<|>|===)?.*$)")
|
||||||
PIP_VERSION_RANGE_SEPARATOR = re.compile(r"^(==|>=|<=|~=|!=|<|>|===)?(.*)$")
|
PIP_VERSION_RANGE_SEPARATOR = re.compile(r"^(==|>=|<=|~=|!=|<|>|===)?(.*)$")
|
||||||
SUPPORTED_PYTHON_TUPLES = [
|
|
||||||
REQUIRED_PYTHON_VER[:2],
|
|
||||||
]
|
|
||||||
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):
|
|
||||||
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
|
|
||||||
]
|
|
||||||
STD_LIBS = {version: set(stdlib_list(version)) for version in SUPPORTED_PYTHON_VERSIONS}
|
|
||||||
|
|
||||||
IGNORE_VIOLATIONS = {
|
IGNORE_VIOLATIONS = {
|
||||||
# Still has standard library requirements.
|
# Still has standard library requirements.
|
||||||
@ -161,13 +148,12 @@ def validate_requirements(integration: Integration) -> None:
|
|||||||
return
|
return
|
||||||
|
|
||||||
# Check for requirements incompatible with standard library.
|
# Check for requirements incompatible with standard library.
|
||||||
for version, std_libs in STD_LIBS.items():
|
for req in all_integration_requirements:
|
||||||
for req in all_integration_requirements:
|
if req in sys.stlib_module_names:
|
||||||
if req in std_libs:
|
integration.add_error(
|
||||||
integration.add_error(
|
"requirements",
|
||||||
"requirements",
|
f"Package {req} is not compatible with the Python standard library",
|
||||||
f"Package {req} is not compatible with Python {version} standard library",
|
)
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
@cache
|
@cache
|
||||||
|
Loading…
x
Reference in New Issue
Block a user