Skip to content

Commit 214f868

Browse files
committed
Merge branch 'doc/update-guide' into 'master'
docs: how to update ESP-IDF env without updating ESP-IDF itself Closes IDFGH-15431 and DOC-11528 See merge request espressif/esp-idf!39761
2 parents 01753bf + f699058 commit 214f868

File tree

5 files changed

+44
-15
lines changed

5 files changed

+44
-15
lines changed

docs/en/api-guides/tools/idf-tools.rst

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ This file is used by the :idf_file:`tools/idf_tools.py` script when installing t
3535
Tools Installation Directory
3636
----------------------------
3737

38-
The ``IDF_TOOLS_PATH`` environment variable specifies the location where the tools are to be downloaded and installed. If not set, the default location will be ``HOME/.espressif`` on Linux and macOS, and ``%USER_PROFILE%\.espressif`` on Windows.
38+
The ``IDF_TOOLS_PATH`` environment variable specifies the location where the tools are to be downloaded and installed. If not set, the default location will be ``$HOME/.espressif`` on Linux and macOS, and ``%USER_PROFILE%\.espressif`` on Windows.
3939

4040
Inside the ``IDF_TOOLS_PATH`` directory, the tools installation scripts create the following directories and files:
4141

@@ -60,6 +60,7 @@ Any mirror server can be used provided the URL matches the ``github.com`` downlo
6060

6161
.. note:: The Espressif download server currently does not mirror everything from GitHub, but only files attached as Assets to some releases, as well as source archives for some releases.
6262

63+
.. _idf-tools-py:
6364

6465
``idf_tools.py`` Script
6566
-----------------------
@@ -119,7 +120,7 @@ The :idf_file:`tools/idf_tools.py` script bundled with ESP-IDF performs several
119120

120121
* ``check``: For each tool, checks whether the tool is available in the system path and in ``IDF_TOOLS_PATH``.
121122

122-
* ``install-python-env``: Creates a Python virtual environment in the ``${IDF_TOOLS_PATH}/python_env`` directory or directly in the directory set by the ``IDF_PYTHON_ENV_PATH`` environment variable, and install the required Python packages there.
123+
* ``install-python-env``: Creates a Python virtual environment in the ``${IDF_TOOLS_PATH}/python_env`` directory or directly in the directory set by the ``IDF_PYTHON_ENV_PATH`` environment variable, and installs the required Python packages there. If the Python virtual environment already exists, packages inside are updated to their latest versions with respect to the ``espidf.constraints.*.txt`` file.
123124

124125
* An optional ``--features`` argument allows one to specify a comma-separated list of features to be added or removed.
125126

docs/en/get-started/linux-macos-setup.rst

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -277,18 +277,29 @@ Step 5. First Steps on ESP-IDF
277277
.. include:: linux-macos-start-project.rst
278278
.. include:: start-project.rst
279279

280-
Tip: Updating ESP-IDF
281-
======================
280+
.. _get-started-update-esp-idf:
281+
282+
Updating ESP-IDF and Python Packages in the ESP-IDF Environment
283+
===============================================================
282284

283285
It is recommended to update ESP-IDF from time to time, as newer versions fix bugs and/or provide new features. Please note that each ESP-IDF major and minor release version has an associated support period, and when one release branch is approaching end of life (EOL), all users are encouraged to upgrade their projects to more recent ESP-IDF releases, to find out more about support periods, see :doc:`ESP-IDF Versions <../versions>`.
284286

285287
The simplest way to do the update is to delete the existing ``esp-idf`` folder and clone it again, as if performing the initial installation described in :ref:`get-started-get-esp-idf`.
286288

287-
Another solution is to update only what has changed. :ref:`The update procedure depends on the version of ESP-IDF you are using <updating>`.
289+
Another solution is to update only what has changed. For specific instructions, please visit :ref:`Updating ESP-IDF <updating-master>` page.
290+
291+
After updating ESP-IDF, execute the install script again (``./install.sh`` in your ``$IDF_PATH``), in case the new ESP-IDF version requires different versions of tools. See instructions at :ref:`get-started-set-up-tools`.
292+
293+
Once all the new tools are installed, enter the ESP-IDF environment using the export script as described in :ref:`get-started-set-up-env`.
288294

289-
After updating ESP-IDF, execute the Install script again, in case the new ESP-IDF version requires different versions of tools. See instructions at :ref:`get-started-set-up-tools`.
295+
Updating Python Packages in the ESP-IDF Environment Without Updating ESP-IDF
296+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
297+
298+
Some features in ESP-IDF are not included directly in the ESP-IDF repository. Instead, they are provided by Python packages such as ``esp-idf-monitor`` or ``esptool``, which are installed in the ESP-IDF environment by the install script. These packages can be updated independently of ESP-IDF. To update them, simply re-run the install script (``./install.sh`` in your ``$IDF_PATH``). If the ESP-IDF environment already exists, the script will update all Python packages in it to the latest versions compatible with the current ESP-IDF version — without updating the ESP-IDF itself.
299+
300+
.. note::
290301

291-
Once the new tools are installed, update the environment using the Export script. See instructions at :ref:`get-started-set-up-env`.
302+
If you are an advanced user and want more control over the update process, you can also check :ref:`idf-tools-py` and its ``install-python-env`` command, which is used by the install script and handles the creation or update of the ESP-IDF environment.
292303

293304
Related Documents
294305
=================

docs/zh_CN/api-guides/tools/idf-tools.rst

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
工具安装目录
3636
----------------------------
3737

38-
``IDF_TOOLS_PATH`` 环境变量指定下载及安装工具的位置。若未设置该变量,Linux 和 macOS 系统的默认下载安装位置为 ``HOME/.espressif``,Windows 系统的默认下载安装位置为 ``%USER_PROFILE%\.espressif``。
38+
``IDF_TOOLS_PATH`` 环境变量指定下载及安装工具的位置。若未设置该变量,Linux 和 macOS 系统的默认下载安装位置为 ``$HOME/.espressif``,Windows 系统的默认下载安装位置为 ``%USER_PROFILE%\.espressif``。
3939

4040
在 ``IDF_TOOLS_PATH`` 目录下,工具安装脚本会创建以下子目录和文件:
4141

@@ -60,6 +60,7 @@ GitHub 资源镜像
6060

6161
.. note:: 目前,乐鑫下载服务器不会镜像 GitHub 上的所有内容,只镜像部分发布版本的附件资源文件及源文件。
6262

63+
.. _idf-tools-py:
6364

6465
``idf_tools.py`` 脚本
6566
---------------------------------------
@@ -119,7 +120,7 @@ ESP-IDF 随附的 :idf_file:`tools/idf_tools.py` 脚本具备以下功能:
119120

120121
* ``check``:检查每个工具是否在系统路径和 ``IDF_TOOLS_PATH`` 中可用。
121122

122-
* ``install-python-env``:在 ``${IDF_TOOLS_PATH}/python_env`` 目录或直接在 ``IDF_PYTHON_ENV_PATH`` 环境变量设置的目录中创建 Python 虚拟环境,并在其中安装所需的 Python 软件包。
123+
* ``install-python-env``:在 ``${IDF_TOOLS_PATH}/python_env`` 目录或直接在 ``IDF_PYTHON_ENV_PATH`` 环境变量设置的目录中创建 Python 虚拟环境,并在其中安装所需的 Python 软件包。若虚拟环境已存在,系统将根据 ``espidf.constraints.*.txt`` 文件中的约束条件,将环境内的软件包更新至最新兼容版本。
123124

124125
* 参数 ``--features`` 为可选项,用于指定要添加或删除的功能列表,功能之间用逗号分隔。
125126

docs/zh_CN/get-started/linux-macos-setup.rst

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -277,18 +277,29 @@ ESP-IDF 工具安装器会下载 Github 发布版本中附带的一些工具,
277277
.. include:: linux-macos-start-project.rst
278278
.. include:: start-project.rst
279279

280-
建议:更新 ESP-IDF
281-
======================
280+
.. _get-started-update-esp-idf:
281+
282+
ESP-IDF 环境更新:升级 ESP-IDF 与 Python 软件包
283+
===================================================
282284

283285
乐鑫会不时推出新版本的 ESP-IDF,修复 bug 或提供新的功能。请注意,ESP-IDF 的每个主要版本和次要版本都有相应的支持期限。支持期限满后,版本停止更新维护,用户可将项目升级到最新的 ESP-IDF 版本。更多关于支持期限的信息,请参考 :doc:`ESP-IDF 版本 <../versions>`。
284286

285287
因此,在使用时,也应注意更新本地版本。最简单的方法是:直接删除本地的 ``esp-idf`` 文件夹,然后按照 :ref:`get-started-get-esp-idf` 中的指示,重新完成克隆。
286288

287-
另一种方法是仅更新变更的部分,具体方式请前往 :ref:`更新 ESP-IDF <updating>` 章节查看。具体更新步骤会根据使用的 ESP-IDF 版本有所不同。
289+
另一种方法是仅更新变更的部分,具体方式请参阅 :ref:`更新 ESP-IDF <updating>` 章节。
290+
291+
为确保工具版本符合新 ESP-IDF 的要求,在更新 ESP-IDF 版本后,请在 ``$IDF_PATH`` 目录下重新运行 ``./install.sh`` 脚本。详细说明请参阅 :ref:`get-started-set-up-tools`。
292+
293+
所有新工具安装完成后,请参考 :ref:`get-started-set-up-env`,运行导出脚本并进入 ESP-IDF 开发环境。
288294

289-
注意,更新完成后,请再次运行安装脚本,以防新版 ESP-IDF 所需的工具也有所更新。具体请参考 :ref:`get-started-set-up-tools`。
295+
ESP-IDF 环境更新:只升级 Python 软件包
296+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
297+
298+
ESP-IDF 的部分功能并非直接包含在主代码库中,而是由 ``esp-idf-monitor``、``esptool`` 等 Python 软件包提供。这些软件包由安装脚本自动部署在 ESP-IDF 环境中,无需升级 ESP-IDF 即可更新,只需重新运行安装脚本(在 ``$IDF_PATH`` 目录下执行 ``./install.sh``)。若 ESP-IDF 环境已存在,则该脚本会在保持 ESP-IDF 版本不变的前提下,将所有 Python 软件包更新至与当前 ESP-IDF 版本兼容的最新版本。
299+
300+
.. note::
290301

291-
一旦重新安装好工具,请使用导出脚本更新环境,具体请参考 :ref:`get-started-set-up-env`。
302+
高级用户如需更灵活地控制更新流程,可参考 :ref:`idf-tools-py` 工具及 ``install-python-env`` 命令。此命令被安装脚本调用,专门用于创建或更新 ESP-IDF 环境
292303

293304
相关文档
294305
=================

tools/idf_tools.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3476,7 +3476,12 @@ def main(argv: List[str]) -> None:
34763476
)
34773477

34783478
install_python_env = subparsers.add_parser(
3479-
'install-python-env', help=('Create Python virtual environment and install the required Python packages')
3479+
'install-python-env',
3480+
help=(
3481+
'Create a Python virtual environment and install the required Python packages. '
3482+
'If the virtual environment already exists, update all Python packages to the latest '
3483+
'versions compatible with the current ESP-IDF version.'
3484+
),
34803485
)
34813486
install_python_env.add_argument(
34823487
'--reinstall', help='Discard the previously installed environment', action='store_true'

0 commit comments

Comments
 (0)