doc: develop: modules: Add a section about package managers

Add a description and example on how modules can describe pip
dependencies.

Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
This commit is contained in:
Pieter De Gendt 2024-11-20 21:40:47 +01:00 committed by Benjamin Cabé
commit 32c59004bf

View file

@ -1021,6 +1021,35 @@ maps, each of which has the following entries:
- ``doc-url``: A URL pointing to the location of the official documentation for
this blob
Package manager dependencies
============================
Zephyr modules can describe dependencies available from package managers,
currently only ``pip`` is supported.
A west extension command ``west packages <manager>`` is available to list
dependencies for Zephyr and present modules that leverage this feature in their
``module.yml`` file.
Run ``west help packages`` for more details.
Python pip
----------
Calling ``west packages pip`` lists `requirement files`_ for Zephyr and modules.
Passing ``--install`` installs these if there's an active virtual environment.
The following example demonstrates a ``zephyr/module.yml`` file with some
requirement files in the ``scripts`` directory of the module.
.. code-block:: yaml
package-managers:
pip:
requirement-files:
- scripts/requirements-build.txt
- scripts/requirements-doc.txt
Module Inclusion
================
@ -1200,3 +1229,4 @@ revision needs to be changed to the commit hash from the module repository.
.. _CMake list: https://cmake.org/cmake/help/latest/manual/cmake-language.7.html#lists
.. _add_subdirectory(): https://cmake.org/cmake/help/latest/command/add_subdirectory.html
.. _GitHub issues: https://github.com/zephyrproject-rtos/zephyr/issues
.. _requirement files: https://pip.pypa.io/en/stable/reference/requirements-file-format/