Repository: home-assistant/core
File: homeassistant/const.py (Python)

Code before:
"""Constants used by Home Assistant components."""

from __future__ import annotations

from enum import StrEnum
from typing import TYPE_CHECKING, Final

from .generated.entity_platforms import EntityPlatforms
from .util.event_type import EventType
from .util.hass_dict import HassKey
from .util.signal_type import SignalType

if TYPE_CHECKING:
    from .core import EventStateChangedData, EventStateReportedData
    from .helpers.typing import NoEventData

APPLICATION_NAME: Final = "HomeAssistant"
MAJOR_VERSION: Final = 2026
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, 13, 2)
REQUIRED_NEXT_PYTHON_VER: Final[tuple[int, int, int]] = (3, 13, 2)
# Truthy date string triggers showing related deprecation warning messages.
REQUIRED_NEXT_PYTHON_HA_RELEASE: Final = ""

# Format for platform files
PLATFORM_FORMAT: Final = "{platform}.{domain}"

# Explicit reexport to allow other modules to import Platform directly from const
Platform = EntityPlatforms

BASE_PLATFORMS: Final = {platform.value for platform in Platform}


# Can be used to specify a catch all when registering state or event listeners.
MATCH_ALL: Final = "*"

# Entity target all constant
ENTITY_MATCH_NONE: Final = "none"
ENTITY_MATCH_ALL: Final = "all"
ENTITY_MATCH_ANY: Final = "any"

# If no name is specified
DEVICE_DEFAULT_NAME: Final = "Unnamed Device"

# Max characters for data stored in the recorder (changes to these limits would require

Review comment (refactor):
We are checking on boot if the required python version is present. Should we remove this check too?
It's not needed in production but maybe we should leave it for dev env?

Code after:
"""Constants used by Home Assistant components."""

from __future__ import annotations

from enum import StrEnum
from typing import TYPE_CHECKING, Final

from .generated.entity_platforms import EntityPlatforms
from .util.event_type import EventType
from .util.hass_dict import HassKey
from .util.signal_type import SignalType

if TYPE_CHECKING:
    from .core import EventStateChangedData, EventStateReportedData
    from .helpers.typing import NoEventData

APPLICATION_NAME: Final = "HomeAssistant"
MAJOR_VERSION: Final = 2026
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, 13, 2)

# Format for platform files
PLATFORM_FORMAT: Final = "{platform}.{domain}"

# Explicit reexport to allow other modules to import Platform directly from const
Platform = EntityPlatforms

BASE_PLATFORMS: Final = {platform.value for platform in Platform}


# Can be used to specify a catch all when registering state or event listeners.
MATCH_ALL: Final = "*"

# Entity target all constant
ENTITY_MATCH_NONE: Final = "none"
ENTITY_MATCH_ALL: Final = "all"
ENTITY_MATCH_ANY: Final = "any"

# If no name is specified
DEVICE_DEFAULT_NAME: Final = "Unnamed Device"

# Max characters for data stored in the recorder (changes to these limits would require
# a database migration)
MAX_LENGTH_EVENT_EVENT_TYPE: Final = 64
MAX_LENGTH_EVENT_ORIGIN: Final = 32