Skip to content

Commit

Permalink
Merge branch 'update/deprecate_python37' into 'master'
Browse files Browse the repository at this point in the history
feat: Drop Python 3.7 support

Closes IDF-4441

See merge request espressif/esp-idf!24897
  • Loading branch information
dobairoland committed Aug 8, 2023
2 parents 267e52a + 8acde05 commit 4bbc57c
Show file tree
Hide file tree
Showing 13 changed files with 21 additions and 22 deletions.
11 changes: 5 additions & 6 deletions .gitlab-ci.yml
Expand Up @@ -56,18 +56,17 @@ variables:
BATCH_BUILD: "1"
V: "0"
CHECKOUT_REF_SCRIPT: "$CI_PROJECT_DIR/tools/ci/checkout_project_ref.py"
PYTHON_VER: 3.7.10
PYTHON_VER: 3.8.17

CLANG_TIDY_RUNNER_PROJ: 2107 # idf/clang-tidy-runner

# Docker images
BOT_DOCKER_IMAGE_TAG: ":latest"

ESP_ENV_IMAGE: "$CI_DOCKER_REGISTRY/esp-env-v5.2:1"
CLANG_STATIC_ANALYSIS_IMAGE: "${CI_DOCKER_REGISTRY}/clang-static-analysis-v5.2:1-1"
ESP_IDF_DOC_ENV_IMAGE: "$CI_DOCKER_REGISTRY/esp-idf-doc-env-v5.2:1-1"
QEMU_IMAGE: "${CI_DOCKER_REGISTRY}/qemu-v5.2:1-20230522"
TARGET_TEST_ENV_IMAGE: "$CI_DOCKER_REGISTRY/target-test-env-v5.2:1"
ESP_ENV_IMAGE: "$CI_DOCKER_REGISTRY/esp-env-v5.2:2"
ESP_IDF_DOC_ENV_IMAGE: "$CI_DOCKER_REGISTRY/esp-idf-doc-env-v5.2:2-1"
QEMU_IMAGE: "${CI_DOCKER_REGISTRY}/qemu-v5.2:2-20230522"
TARGET_TEST_ENV_IMAGE: "$CI_DOCKER_REGISTRY/target-test-env-v5.2:2"

SONARQUBE_SCANNER_IMAGE: "${CI_DOCKER_REGISTRY}/sonarqube-scanner:3"

Expand Down
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Expand Up @@ -34,7 +34,7 @@ repos:
- id: flake8
args: ['--config=.flake8', '--tee', '--benchmark']
- repo: https://github.com/pycqa/isort
rev: 5.11.5 # python 3.7 compatible
rev: 5.12.0 # python 3.8 compatible
hooks:
- id: isort
name: isort (python)
Expand Down
2 changes: 1 addition & 1 deletion docs/en/api-guides/build-system.rst
Expand Up @@ -119,7 +119,7 @@ For more detailed information about integrating ESP-IDF with CMake into an IDE,
Setting up the Python Interpreter
---------------------------------

ESP-IDF works well with Python version 3.7+.
ESP-IDF works well with Python version 3.8+.

``idf.py`` and other Python scripts will run with the default Python interpreter, i.e. ``python``. You can switch to a different one like ``python3 $IDF_PATH/tools/idf.py ...``, or you can set up a shell alias or another script to simplify the command.

Expand Down
2 changes: 1 addition & 1 deletion docs/en/api-guides/tools/idf-docker-image.rst
Expand Up @@ -14,7 +14,7 @@ ESP-IDF Docker image (``espressif/idf``) is intended for building applications a
The image contains:

- Common utilities such as ``git``, ``wget``, ``curl``, and ``zip``.
- Python 3.7 or newer.
- Python 3.8 or newer.
- A copy of a specific version of ESP-IDF. See below for information about versions. ``IDF_PATH`` environment variable is set and points to the ESP-IDF location in the container.
- All the build tools required for the specific version of ESP-IDF: CMake, Ninja, cross-compiler toolchains, etc.
- All Python packages required by ESP-IDF are installed in a virtual environment.
Expand Down
2 changes: 1 addition & 1 deletion docs/en/contribute/install-pre-commit-hook.rst
Expand Up @@ -6,7 +6,7 @@ Install pre-commit Hook for ESP-IDF Project
Required Dependency
-------------------

Python 3.7.* or above. This is our recommended Python version for IDF developers.
Python 3.8.* or above. This is our recommended Python version for IDF developers.

If you still have Python versions not compatible, update your Python versions before installing the pre-commit hook.

Expand Down
2 changes: 1 addition & 1 deletion docs/en/get-started/start-project.rst
Expand Up @@ -455,7 +455,7 @@ With some Linux distributions, you may get the ``Failed to open port /dev/ttyUSB
Python compatibility
~~~~~~~~~~~~~~~~~~~~

ESP-IDF supports Python 3.7 or newer. It is recommended to upgrade your operating system to a recent version satisfying this requirement. Other options include the installation of Python from `sources <https://www.python.org/downloads/>`_ or the use of a Python version management system such as `pyenv <https://github.com/pyenv/pyenv>`_.
ESP-IDF supports Python 3.8 or newer. It is recommended to upgrade your operating system to a recent version satisfying this requirement. Other options include the installation of Python from `sources <https://www.python.org/downloads/>`_ or the use of a Python version management system such as `pyenv <https://github.com/pyenv/pyenv>`_.

.. only:: esp32 or esp32s2 or esp32s3

Expand Down
2 changes: 1 addition & 1 deletion docs/zh_CN/api-guides/build-system.rst
Expand Up @@ -119,7 +119,7 @@ idf.py
设置 Python 解释器
------------------

ESP-IDF 适用于 Python 3.7 以上版本。
ESP-IDF 适用于 Python 3.8 以上版本。

``idf.py`` 和其他的 Python 脚本会使用默认的 Python 解释器运行,如 ``python``。你可以通过 ``python3 $IDF_PATH/tools/idf.py ...`` 命令切换到别的 Python 解释器,或者通过设置 shell 别名或其他脚本来简化该命令。

Expand Down
2 changes: 1 addition & 1 deletion docs/zh_CN/api-guides/tools/idf-docker-image.rst
Expand Up @@ -14,7 +14,7 @@ ESP-IDF Docker 镜像 (``espressif/idf``) 为使用特定版本的 ESP-IDF 自
该镜像包含以下内容:

- 常见的实用工具,如 ``git``、``wget``、``curl`` 和 ``zip``。
- Python 3.7 或更高版本。
- Python 3.8 或更高版本。
- 特定版本 ESP-IDF 的副本。有关版本信息,请参阅下文。该副本中设置了 ``IDF_PATH`` 环境变量,并指向容器中 ESP-IDF 的位置。
- 构建特定版本 ESP-IDF 所需工具:CMake、Ninja、交叉编译器工具链等。
- ESP-IDF 需要的所有 Python 软件包。这些软件包均已安装在虚拟环境中。
Expand Down
2 changes: 1 addition & 1 deletion docs/zh_CN/contribute/install-pre-commit-hook.rst
Expand Up @@ -6,7 +6,7 @@
环境依赖
---------------

我们向 IDF 开发人员推荐 Python 3.7.* 及以上版本。
我们向 IDF 开发人员推荐 Python 3.8.* 及以上版本。

如果你已安装了不兼容的 Python 版本,应在安装 pre-commit 工具前进行更新。

Expand Down
2 changes: 1 addition & 1 deletion docs/zh_CN/get-started/start-project.rst
Expand Up @@ -455,7 +455,7 @@
兼容的 Python 版本
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

ESP-IDF 支持 Python 3.7 及以上版本,建议升级操作系统到最新版本从而更新 Python。也可选择从 `sources <https://www.python.org/downloads/>`_ 安装最新版 Python,或使用 Python 管理系统如 `pyenv <https://github.com/pyenv/pyenv>`_ 对版本进行升级管理。
ESP-IDF 支持 Python 3.8 及以上版本,建议升级操作系统到最新版本从而更新 Python。也可选择从 `sources <https://www.python.org/downloads/>`_ 安装最新版 Python,或使用 Python 管理系统如 `pyenv <https://github.com/pyenv/pyenv>`_ 对版本进行升级管理。

.. only:: esp32 or esp32s2 or esp32s3

Expand Down
4 changes: 2 additions & 2 deletions tools/detect_python.fish
Expand Up @@ -3,11 +3,11 @@
# This is a port of detect_python.sh. More information are provided there.

set OLDEST_PYTHON_SUPPORTED_MAJOR 3
set OLDEST_PYTHON_SUPPORTED_MINOR 7
set OLDEST_PYTHON_SUPPORTED_MINOR 8

set -x ESP_PYTHON python

for p_cmd in python3 python python3.7 python3.8 python3.9 python3.10 python3.11 python3.12;
for p_cmd in python3 python python3.8 python3.9 python3.10 python3.11 python3.12;
$p_cmd --version >/dev/null 2>&1; or continue
echo "Checking \"$p_cmd\" ..."

Expand Down
4 changes: 2 additions & 2 deletions tools/detect_python.sh
Expand Up @@ -8,11 +8,11 @@
# 3. If required version of python is not found, script will fail

OLDEST_PYTHON_SUPPORTED_MAJOR=3
OLDEST_PYTHON_SUPPORTED_MINOR=7
OLDEST_PYTHON_SUPPORTED_MINOR=8

ESP_PYTHON=python

for p_cmd in python3 python python3.7 python3.8 python3.9 python3.10 python3.11 python3.12; do
for p_cmd in python3 python python3.8 python3.9 python3.10 python3.11 python3.12; do
$p_cmd --version >/dev/null 2>&1 || continue
echo "Checking \"$p_cmd\" ..."

Expand Down
6 changes: 3 additions & 3 deletions tools/python_version_checker.py
@@ -1,14 +1,14 @@
#!/usr/bin/env python
#
# SPDX-FileCopyrightText: 2021-2022 Espressif Systems (Shanghai) CO LTD
# SPDX-FileCopyrightText: 2021-2023 Espressif Systems (Shanghai) CO LTD
#
# SPDX-License-Identifier: Apache-2.0
#
# Script for checking the compatibility of the Python interpreter with ESP-IDF.
#
# There are related tools/detect_python.{sh,fish} scripts which are called earlier when the paths are not properly
# set-up and they only intend to prefer the use of Python 3 over Python 2. Why not more? All possible executables
# (python3.7, python3.8, ...) cannot be hardcoded there and at the end, the user is responsible to set-up a system
# (python3.8, python3.9, ...) cannot be hardcoded there and at the end, the user is responsible to set-up a system
# where "python" or "python3" of compatible version is available.

import sys
Expand All @@ -20,7 +20,7 @@
except ImportError:
pass

OLDEST_PYTHON_SUPPORTED = (3, 7) # keep it as tuple for comparison with sys.version_info
OLDEST_PYTHON_SUPPORTED = (3, 8) # keep it as tuple for comparison with sys.version_info


def _ver_to_str(it): # type: (Iterable) -> str
Expand Down

0 comments on commit 4bbc57c

Please sign in to comment.