diff --git a/homeassistant/bootstrap.py b/homeassistant/bootstrap.py index 79de0b25453..12fbc6f232f 100644 --- a/homeassistant/bootstrap.py +++ b/homeassistant/bootstrap.py @@ -11,7 +11,11 @@ from typing import Any, Dict, Optional, Set import voluptuous as vol from homeassistant import config as conf_util, config_entries, core, loader -from homeassistant.const import EVENT_HOMEASSISTANT_CLOSE +from homeassistant.const import ( + EVENT_HOMEASSISTANT_CLOSE, + REQUIRED_NEXT_PYTHON_DATE, + REQUIRED_NEXT_PYTHON_VER, +) from homeassistant.exceptions import HomeAssistantError from homeassistant.setup import async_setup_component from homeassistant.util.logging import AsyncHandler @@ -95,11 +99,14 @@ async def async_from_config_dict( stop = time() _LOGGER.info("Home Assistant initialized in %.2fs", stop - start) - if sys.version_info[:3] < (3, 7, 0): + if REQUIRED_NEXT_PYTHON_DATE and sys.version_info[:3] < REQUIRED_NEXT_PYTHON_VER: msg = ( - "Python 3.6 support is deprecated and will " - "be removed in the first release after December 15, 2019. Please " - "upgrade Python to 3.7.0 or higher." + "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 the first release after {REQUIRED_NEXT_PYTHON_DATE}. " + "Please upgrade Python to " + f"{'.'.join(str(x) for x in REQUIRED_NEXT_PYTHON_VER)} or " + "higher." ) _LOGGER.warning(msg) hass.components.persistent_notification.async_create( diff --git a/homeassistant/const.py b/homeassistant/const.py index dc937f81482..ba7e7a66126 100644 --- a/homeassistant/const.py +++ b/homeassistant/const.py @@ -5,6 +5,9 @@ PATCH_VERSION = "0.dev0" __short_version__ = "{}.{}".format(MAJOR_VERSION, MINOR_VERSION) __version__ = "{}.{}".format(__short_version__, PATCH_VERSION) REQUIRED_PYTHON_VER = (3, 6, 1) +# Truthy date string triggers showing related deprecation warning messages. +REQUIRED_NEXT_PYTHON_VER = (3, 7, 0) +REQUIRED_NEXT_PYTHON_DATE = "December 15, 2019" # Format for platform files PLATFORM_FORMAT = "{platform}.{domain}"