Drop Python 3.12 support (#135589)
parent
fa96168488
commit
60bdc13c94
|
@ -41,8 +41,8 @@ env:
|
|||
UV_CACHE_VERSION: 1
|
||||
MYPY_CACHE_VERSION: 9
|
||||
HA_SHORT_VERSION: "2025.2"
|
||||
DEFAULT_PYTHON: "3.12"
|
||||
ALL_PYTHON_VERSIONS: "['3.12', '3.13']"
|
||||
DEFAULT_PYTHON: "3.13"
|
||||
ALL_PYTHON_VERSIONS: "['3.13']"
|
||||
# 10.3 is the oldest supported version
|
||||
# - 10.3.32 is the version currently shipped with Synology (as of 17 Feb 2022)
|
||||
# 10.6 is the current long-term-support
|
||||
|
|
|
@ -10,7 +10,7 @@ on:
|
|||
- "**strings.json"
|
||||
|
||||
env:
|
||||
DEFAULT_PYTHON: "3.12"
|
||||
DEFAULT_PYTHON: "3.13"
|
||||
|
||||
jobs:
|
||||
upload:
|
||||
|
|
|
@ -17,7 +17,7 @@ on:
|
|||
- "script/gen_requirements_all.py"
|
||||
|
||||
env:
|
||||
DEFAULT_PYTHON: "3.12"
|
||||
DEFAULT_PYTHON: "3.13"
|
||||
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.ref_name}}
|
||||
|
|
|
@ -4,9 +4,8 @@ from __future__ import annotations
|
|||
|
||||
import logging
|
||||
import types
|
||||
from typing import Any, Generic
|
||||
from typing import Any, Generic, TypeVar
|
||||
|
||||
from typing_extensions import TypeVar
|
||||
import voluptuous as vol
|
||||
from voluptuous.humanize import humanize_error
|
||||
|
||||
|
|
|
@ -5,9 +5,8 @@ from __future__ import annotations
|
|||
from collections.abc import Mapping
|
||||
import logging
|
||||
import types
|
||||
from typing import Any, Generic
|
||||
from typing import Any, Generic, TypeVar
|
||||
|
||||
from typing_extensions import TypeVar
|
||||
import voluptuous as vol
|
||||
from voluptuous.humanize import humanize_error
|
||||
|
||||
|
|
|
@ -3,9 +3,9 @@
|
|||
from __future__ import annotations
|
||||
|
||||
import logging
|
||||
import telnetlib # pylint: disable=deprecated-module
|
||||
from typing import Final
|
||||
|
||||
import telnetlib # pylint: disable=deprecated-module
|
||||
import voluptuous as vol
|
||||
|
||||
from homeassistant.components.device_tracker import (
|
||||
|
|
|
@ -1,9 +1,6 @@
|
|||
"""Assist pipeline Websocket API."""
|
||||
|
||||
import asyncio
|
||||
|
||||
# Suppressing disable=deprecated-module is needed for Python 3.11
|
||||
import audioop # pylint: disable=deprecated-module
|
||||
import base64
|
||||
from collections.abc import AsyncGenerator, Callable
|
||||
import contextlib
|
||||
|
@ -11,6 +8,8 @@ import logging
|
|||
import math
|
||||
from typing import Any, Final
|
||||
|
||||
# Suppressing disable=deprecated-module is needed for Python 3.11
|
||||
import audioop # pylint: disable=deprecated-module
|
||||
import voluptuous as vol
|
||||
|
||||
from homeassistant.components import conversation, stt, tts, websocket_api
|
||||
|
|
|
@ -2,9 +2,7 @@
|
|||
|
||||
from __future__ import annotations
|
||||
|
||||
from typing import TYPE_CHECKING, Any
|
||||
|
||||
from typing_extensions import TypeVar
|
||||
from typing import TYPE_CHECKING, Any, TypeVar
|
||||
|
||||
from homeassistant.core import CALLBACK_TYPE, HomeAssistant, callback
|
||||
from homeassistant.helpers.update_coordinator import (
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
from contextlib import suppress
|
||||
from functools import partial
|
||||
import logging
|
||||
from typing import Generic
|
||||
from typing import Generic, TypeVar
|
||||
|
||||
import broadlink as blk
|
||||
from broadlink.exceptions import (
|
||||
|
@ -13,7 +13,6 @@ from broadlink.exceptions import (
|
|||
ConnectionClosedError,
|
||||
NetworkTimeoutError,
|
||||
)
|
||||
from typing_extensions import TypeVar
|
||||
|
||||
from homeassistant.config_entries import ConfigEntry
|
||||
from homeassistant.const import (
|
||||
|
|
|
@ -5,11 +5,10 @@ from __future__ import annotations
|
|||
from abc import ABC, abstractmethod
|
||||
from datetime import datetime, timedelta
|
||||
import logging
|
||||
from typing import TYPE_CHECKING, Any, Generic
|
||||
from typing import TYPE_CHECKING, Any, Generic, TypeVar
|
||||
|
||||
import broadlink as blk
|
||||
from broadlink.exceptions import AuthorizationError, BroadlinkException
|
||||
from typing_extensions import TypeVar
|
||||
|
||||
from homeassistant.helpers.update_coordinator import DataUpdateCoordinator, UpdateFailed
|
||||
from homeassistant.util import dt as dt_util
|
||||
|
|
|
@ -3,8 +3,8 @@
|
|||
from __future__ import annotations
|
||||
|
||||
import logging
|
||||
import telnetlib # pylint: disable=deprecated-module
|
||||
|
||||
import telnetlib # pylint: disable=deprecated-module
|
||||
import voluptuous as vol
|
||||
|
||||
from homeassistant.components.media_player import (
|
||||
|
|
|
@ -5,9 +5,9 @@ from __future__ import annotations
|
|||
from datetime import timedelta
|
||||
import logging
|
||||
import socket
|
||||
from telnetlib import Telnet # pylint: disable=deprecated-module
|
||||
from typing import Any
|
||||
|
||||
from telnetlib import Telnet # pylint: disable=deprecated-module
|
||||
import voluptuous as vol
|
||||
|
||||
from homeassistant.components.sensor import (
|
||||
|
|
|
@ -4,8 +4,7 @@ from __future__ import annotations
|
|||
|
||||
from collections.abc import Mapping
|
||||
from pathlib import Path
|
||||
import sys
|
||||
from typing import Final
|
||||
from typing import TYPE_CHECKING, Final
|
||||
|
||||
from aiohttp.hdrs import CACHE_CONTROL, CONTENT_TYPE
|
||||
from aiohttp.web import FileResponse, Request, StreamResponse
|
||||
|
@ -18,14 +17,12 @@ CACHE_HEADER = f"public, max-age={CACHE_TIME}"
|
|||
CACHE_HEADERS: Mapping[str, str] = {CACHE_CONTROL: CACHE_HEADER}
|
||||
RESPONSE_CACHE: LRU[tuple[str, Path], tuple[Path, str]] = LRU(512)
|
||||
|
||||
if sys.version_info >= (3, 13):
|
||||
# guess_type is soft-deprecated in 3.13
|
||||
# for paths and should only be used for
|
||||
# URLs. guess_file_type should be used
|
||||
# for paths instead.
|
||||
_GUESSER = CONTENT_TYPES.guess_file_type
|
||||
else:
|
||||
if TYPE_CHECKING:
|
||||
# mypy uses Python 3.12 syntax for type checking
|
||||
# once it uses Python 3.13, this can be removed
|
||||
_GUESSER = CONTENT_TYPES.guess_type
|
||||
else:
|
||||
_GUESSER = CONTENT_TYPES.guess_file_type
|
||||
|
||||
|
||||
class CachingStaticResource(StaticResource):
|
||||
|
|
|
@ -3,9 +3,9 @@
|
|||
from __future__ import annotations
|
||||
|
||||
import logging
|
||||
import telnetlib # pylint: disable=deprecated-module
|
||||
from typing import Final
|
||||
|
||||
import telnetlib # pylint: disable=deprecated-module
|
||||
import voluptuous as vol
|
||||
|
||||
from homeassistant.components.media_player import (
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
from collections.abc import Awaitable, Callable, Coroutine
|
||||
from dataclasses import dataclass
|
||||
from typing import Any, Concatenate, Generic, cast
|
||||
from typing import Any, Concatenate, Generic, TypeVar, cast
|
||||
|
||||
from ring_doorbell import (
|
||||
AuthenticationError,
|
||||
|
@ -11,7 +11,6 @@ from ring_doorbell import (
|
|||
RingGeneric,
|
||||
RingTimeout,
|
||||
)
|
||||
from typing_extensions import TypeVar
|
||||
|
||||
from homeassistant.components.automation import automations_with_entity
|
||||
from homeassistant.components.script import scripts_with_entity
|
||||
|
|
|
@ -4,9 +4,9 @@ from __future__ import annotations
|
|||
|
||||
from datetime import timedelta
|
||||
import logging
|
||||
import telnetlib # pylint: disable=deprecated-module
|
||||
from typing import Any
|
||||
|
||||
import telnetlib # pylint: disable=deprecated-module
|
||||
import voluptuous as vol
|
||||
|
||||
from homeassistant.components.switch import (
|
||||
|
|
|
@ -4,8 +4,8 @@ from __future__ import annotations
|
|||
|
||||
import logging
|
||||
import re
|
||||
import telnetlib # pylint: disable=deprecated-module
|
||||
|
||||
import telnetlib # pylint: disable=deprecated-module
|
||||
import voluptuous as vol
|
||||
|
||||
from homeassistant.components.device_tracker import (
|
||||
|
|
|
@ -8,10 +8,19 @@ from contextlib import suppress
|
|||
from datetime import timedelta
|
||||
from functools import partial
|
||||
import logging
|
||||
from typing import Any, Final, Generic, Literal, Required, TypedDict, cast, final
|
||||
from typing import (
|
||||
Any,
|
||||
Final,
|
||||
Generic,
|
||||
Literal,
|
||||
Required,
|
||||
TypedDict,
|
||||
TypeVar,
|
||||
cast,
|
||||
final,
|
||||
)
|
||||
|
||||
from propcache import cached_property
|
||||
from typing_extensions import TypeVar
|
||||
import voluptuous as vol
|
||||
|
||||
from homeassistant.config_entries import ConfigEntry
|
||||
|
|
|
@ -22,11 +22,10 @@ from functools import cache
|
|||
import logging
|
||||
from random import randint
|
||||
from types import MappingProxyType
|
||||
from typing import TYPE_CHECKING, Any, Generic, Self, cast
|
||||
from typing import TYPE_CHECKING, Any, Generic, Self, TypeVar, cast
|
||||
|
||||
from async_interrupt import interrupt
|
||||
from propcache import cached_property
|
||||
from typing_extensions import TypeVar
|
||||
import voluptuous as vol
|
||||
|
||||
from . import data_entry_flow, loader
|
||||
|
|
|
@ -28,10 +28,10 @@ MINOR_VERSION: Final = 2
|
|||
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, 12, 0)
|
||||
REQUIRED_PYTHON_VER: Final[tuple[int, int, int]] = (3, 13, 0)
|
||||
REQUIRED_NEXT_PYTHON_VER: Final[tuple[int, int, int]] = (3, 13, 0)
|
||||
# Truthy date string triggers showing related deprecation warning messages.
|
||||
REQUIRED_NEXT_PYTHON_HA_RELEASE: Final = "2025.2"
|
||||
REQUIRED_NEXT_PYTHON_HA_RELEASE: Final = ""
|
||||
|
||||
# Format for platform files
|
||||
PLATFORM_FORMAT: Final = "{platform}.{domain}"
|
||||
|
|
|
@ -36,12 +36,12 @@ from typing import (
|
|||
NotRequired,
|
||||
Self,
|
||||
TypedDict,
|
||||
TypeVar,
|
||||
cast,
|
||||
overload,
|
||||
)
|
||||
|
||||
from propcache import cached_property, under_cached_property
|
||||
from typing_extensions import TypeVar
|
||||
import voluptuous as vol
|
||||
|
||||
from . import util
|
||||
|
|
|
@ -12,9 +12,8 @@ from dataclasses import dataclass
|
|||
from enum import StrEnum
|
||||
import logging
|
||||
from types import MappingProxyType
|
||||
from typing import Any, Generic, Required, TypedDict, cast
|
||||
from typing import Any, Generic, Required, TypedDict, TypeVar, cast
|
||||
|
||||
from typing_extensions import TypeVar
|
||||
import voluptuous as vol
|
||||
|
||||
from .core import HomeAssistant, callback
|
||||
|
|
|
@ -11,9 +11,8 @@ from hashlib import md5
|
|||
from itertools import groupby
|
||||
import logging
|
||||
from operator import attrgetter
|
||||
from typing import Any, Generic, TypedDict
|
||||
from typing import Any, Generic, TypedDict, TypeVar
|
||||
|
||||
from typing_extensions import TypeVar
|
||||
import voluptuous as vol
|
||||
from voluptuous.humanize import humanize_error
|
||||
|
||||
|
|
|
@ -3,10 +3,9 @@
|
|||
from __future__ import annotations
|
||||
|
||||
from http import HTTPStatus
|
||||
from typing import Any, Generic
|
||||
from typing import Any, Generic, TypeVar
|
||||
|
||||
from aiohttp import web
|
||||
from typing_extensions import TypeVar
|
||||
import voluptuous as vol
|
||||
import voluptuous_serialize
|
||||
|
||||
|
|
|
@ -7,9 +7,7 @@ from collections.abc import Callable, Iterable
|
|||
from datetime import timedelta
|
||||
import logging
|
||||
from types import ModuleType
|
||||
from typing import Any, Generic
|
||||
|
||||
from typing_extensions import TypeVar
|
||||
from typing import Any, Generic, TypeVar
|
||||
|
||||
from homeassistant import config as conf_util
|
||||
from homeassistant.config_entries import ConfigEntry
|
||||
|
|
|
@ -9,13 +9,12 @@ from datetime import datetime, timedelta
|
|||
import logging
|
||||
from random import randint
|
||||
from time import monotonic
|
||||
from typing import Any, Generic, Protocol
|
||||
from typing import Any, Generic, Protocol, TypeVar
|
||||
import urllib.error
|
||||
|
||||
import aiohttp
|
||||
from propcache import cached_property
|
||||
import requests
|
||||
from typing_extensions import TypeVar
|
||||
|
||||
from homeassistant import config_entries
|
||||
from homeassistant.const import EVENT_HOMEASSISTANT_STOP
|
||||
|
|
|
@ -6,9 +6,7 @@ Custom for type checking. See stub file.
|
|||
from __future__ import annotations
|
||||
|
||||
from collections.abc import Mapping
|
||||
from typing import Any, Generic
|
||||
|
||||
from typing_extensions import TypeVar
|
||||
from typing import Any, Generic, TypeVar
|
||||
|
||||
_DataT = TypeVar("_DataT", bound=Mapping[str, Any], default=Mapping[str, Any])
|
||||
|
||||
|
|
|
@ -2,9 +2,7 @@
|
|||
# ruff: noqa: PYI021 # Allow docstrings
|
||||
|
||||
from collections.abc import Mapping
|
||||
from typing import Any, Generic
|
||||
|
||||
from typing_extensions import TypeVar
|
||||
from typing import Any, Generic, TypeVar
|
||||
|
||||
__all__ = [
|
||||
"EventType",
|
||||
|
|
|
@ -18,11 +18,10 @@ classifiers = [
|
|||
"Intended Audience :: Developers",
|
||||
"License :: OSI Approved :: Apache Software License",
|
||||
"Operating System :: OS Independent",
|
||||
"Programming Language :: Python :: 3.12",
|
||||
"Programming Language :: Python :: 3.13",
|
||||
"Topic :: Home Automation",
|
||||
]
|
||||
requires-python = ">=3.12.0"
|
||||
requires-python = ">=3.13.0"
|
||||
dependencies = [
|
||||
"aiodns==3.2.0",
|
||||
# Integrations may depend on hassio integration without listing it to
|
||||
|
@ -104,7 +103,7 @@ include-package-data = true
|
|||
include = ["homeassistant*"]
|
||||
|
||||
[tool.pylint.MAIN]
|
||||
py-version = "3.12"
|
||||
py-version = "3.13"
|
||||
# Use a conservative default here; 2 should speed up most setups and not hurt
|
||||
# any too bad. Override on command line as appropriate.
|
||||
jobs = 2
|
||||
|
|
|
@ -9,8 +9,6 @@ import os
|
|||
from pathlib import Path
|
||||
from typing import Final
|
||||
|
||||
from homeassistant.const import REQUIRED_PYTHON_VER
|
||||
|
||||
from .model import Config, Integration
|
||||
|
||||
# Component modules which should set no_implicit_reexport = true.
|
||||
|
@ -31,7 +29,18 @@ HEADER: Final = """
|
|||
""".lstrip()
|
||||
|
||||
GENERAL_SETTINGS: Final[dict[str, str]] = {
|
||||
"python_version": ".".join(str(x) for x in REQUIRED_PYTHON_VER[:2]),
|
||||
# We use @dataclass_transform in all our EntityDescriptions, causing
|
||||
# `__replace__` to be already synthesized by mypy, causing **every** use of
|
||||
# our entity descriptions to fail:
|
||||
#
|
||||
# error: Signature of "__replace__" incompatible with supertype "EntityDescription"
|
||||
#
|
||||
# Until this is fixed in mypy, we keep mypy locked on to Python 3.12 as we
|
||||
# have done for the past few releases.
|
||||
#
|
||||
# Ref: https://github.com/python/mypy/issues/18216
|
||||
# "python_version": ".".join(str(x) for x in REQUIRED_PYTHON_VER[:2]),
|
||||
"python_version": "3.12",
|
||||
"platform": "linux",
|
||||
"plugins": ", ".join( # noqa: FLY002
|
||||
[
|
||||
|
|
|
@ -25,13 +25,12 @@ import os
|
|||
import pathlib
|
||||
import time
|
||||
from types import FrameType, ModuleType
|
||||
from typing import Any, Literal, NoReturn
|
||||
from typing import Any, Literal, NoReturn, TypeVar
|
||||
from unittest.mock import AsyncMock, Mock, patch
|
||||
|
||||
from aiohttp.test_utils import unused_port as get_test_instance_port # noqa: F401
|
||||
import pytest
|
||||
from syrupy import SnapshotAssertion
|
||||
from typing_extensions import TypeVar
|
||||
import voluptuous as vol
|
||||
|
||||
from homeassistant import auth, bootstrap, config_entries, loader
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
"""Fixtures for Homee integration tests."""
|
||||
|
||||
from collections.abc import Generator
|
||||
from unittest.mock import AsyncMock, MagicMock, patch
|
||||
|
||||
import pytest
|
||||
from typing_extensions import Generator
|
||||
|
||||
from homeassistant.components.homee.const import DOMAIN
|
||||
from homeassistant.const import CONF_HOST, CONF_PASSWORD, CONF_USERNAME
|
||||
|
|
Loading…
Reference in New Issue