* [PATCH 0/3] Add a "Library Functions" section to the ref-manual
@ 2026-11-24 13:17 Antonin Godard
2026-11-24 13:17 ` [PATCH 1/3] conf.py: enable sphinx.ext.autodoc Antonin Godard
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Antonin Godard @ 2026-11-24 13:17 UTC (permalink / raw)
To: docs; +Cc: Thomas Petazzoni, Antonin Godard
This series adds Sphinx documentation for the oe library. This series
depends on two others:
- one for openembedded-core, to improve and format docstrings:
https://lore.kernel.org/r/20261116-oe-lib-docstrings-v1-0-0c894f6a1064@bootlin.com (merged)
- two for the autobuilder, to clone bitbake and oe-core before building
the docs (yocto-autobuilder2 and yocto-autobuilder-helper):
https://lore.kernel.org/r/20261120-run-docs-build-with-oecore-v1-1-75124e549421@bootlin.com (merged)
https://lore.kernel.org/r/20261124-docs-build-oecore-functions-v1-0-ce9f3c4fbad4@bootlin.com (sent)
Signed-off-by: Antonin Godard <antonin.godard@bootlin.com>
---
Antonin Godard (3):
conf.py: enable sphinx.ext.autodoc
ref-manual/terms.rst: add the Datastore definition
ref-manual: add a Library Functions section
documentation/README | 21 ++++++++
documentation/conf.py | 33 ++++++++++++
documentation/ref-manual/index.rst | 1 +
documentation/ref-manual/library-functions.rst | 72 ++++++++++++++++++++++++++
documentation/ref-manual/terms.rst | 3 ++
5 files changed, 130 insertions(+)
---
base-commit: 1ced0db0c39bb85213a3c20dd32158430944ea4e
change-id: 20261102-oe-utils-docs-b617e47a93cc
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH 1/3] conf.py: enable sphinx.ext.autodoc
2026-11-24 13:17 [PATCH 0/3] Add a "Library Functions" section to the ref-manual Antonin Godard
@ 2026-11-24 13:17 ` Antonin Godard
2026-11-24 13:17 ` [PATCH 2/3] ref-manual/terms.rst: add the Datastore definition Antonin Godard
2026-11-24 13:17 ` [PATCH 3/3] ref-manual: add a Library Functions section Antonin Godard
2 siblings, 0 replies; 4+ messages in thread
From: Antonin Godard @ 2026-11-24 13:17 UTC (permalink / raw)
To: docs; +Cc: Thomas Petazzoni, Antonin Godard
Enable the sphinx.ext.autodoc extension for this Sphinx build, but do
not make it a requirement for building the documentation locally. The
idea is to auto-document functions from openembedded-core here (which
depends on bitbake since the oe library imports the bb library).
However, this is most likely not the case for people wanting to
contribute the yocto-docs documentation: therefore, ignore any
'autodoc.import_object' warning by default.
An exception to that rule is when building from the Autobuilder, where
we _need_ those warnings (turned to errors) to be caught. We expect the
Autobuilder to set AUTOBUILDER_BUILD to 1 in these conditions.
Signed-off-by: Antonin Godard <antonin.godard@bootlin.com>
---
documentation/README | 21 +++++++++++++++++++++
documentation/conf.py | 33 +++++++++++++++++++++++++++++++++
2 files changed, 54 insertions(+)
diff --git a/documentation/README b/documentation/README
index 56abe83bb..da6838695 100644
--- a/documentation/README
+++ b/documentation/README
@@ -128,6 +128,27 @@ but require you to use Pipenv for them to run and aren't available when
following the instructions from
https://docs.yoctoproject.org/dev/ref-manual/system-requirements.html#required-packages-for-the-build-host.
+Note 2: while not a requirement to build the documentation, some parts of it
+need the [BitBake] and [OpenEmbedded-Core] repositories to be cloned next to the
+yocto-docs repository. This is used to generate documentation from Python
+docstrings. The expected default layout of the different repositories is is:
+
+ bitbake/
+ openembedded-core/
+ yocto-docs/
+
+The paths to BitBake and OpenEmbedded-Core can be overridden by setting the
+BITBAKE_REPO_PATH and OECORE_REPO_PATH environment variables respectively
+before building.
+
+Both BitBake and OpenEmbedded-Core should be cloned to the closest matching tag
+(e.g. 'yocto-6.1' for each of them).
+
+If not cloned, these parts of the documentation will be left empty.
+
+[BitBake]: https://git.openembedded.org/bitbake/
+[OpenEmbedded-Core]: https://git.openembedded.org/openembedded-core/
+
Style checking the Yocto Project documentation
==============================================
diff --git a/documentation/conf.py b/documentation/conf.py
index d2252d5ab..833aa50b3 100644
--- a/documentation/conf.py
+++ b/documentation/conf.py
@@ -10,8 +10,10 @@ import datetime
import importlib.util
import os
import re
+import subprocess
import sys
+from pathlib import Path
from sphinx.builders.epub3 import Epub3Builder
from sphinx.search import SearchEnglish
from sphinx.search import languages
@@ -37,6 +39,30 @@ author = 'The Linux Foundation'
sys.path.insert(0, os.path.abspath('sphinx'))
+# We require openembedded-core's library to auto-document utilities and such,
+# which itself requires bitbake's library. We assume their default location is
+# next to the yocto-docs repository, but can be overridden with environment
+# variables.
+yocto_docs_parent_dir = Path(__file__).resolve().parent.parent.parent
+bitbake_dir = os.getenv("BITBAKE_REPO_PATH", str(yocto_docs_parent_dir / 'bitbake'))
+oecore_dir = os.getenv("OECORE_REPO_PATH", str(yocto_docs_parent_dir / 'openembedded-core'))
+sys.path.insert(0, os.path.join(bitbake_dir, 'lib'))
+sys.path.insert(0, os.path.join(oecore_dir, 'meta/lib'))
+
+# Check that we can import the oe module. If we can, show some information about
+# the repositories (useful for debugging in case of version mismatch).
+if not importlib.util.find_spec('oe'):
+ print("NOTE: bitbake and/or openembedded-core not found next to yocto-docs, "
+ "auto-documenting oe.* functions will not work")
+ if os.getenv('AUTOBUILDER_BUILD', '0') == '1':
+ sys.exit(1)
+else:
+ bitbake_rev = subprocess.check_output(["git", "-C", bitbake_dir, "describe"], encoding="utf-8").strip()
+ oecore_rev = subprocess.check_output(["git", "-C", oecore_dir, "describe"], encoding="utf-8").strip()
+ print("Found bb and oe modules:\n"
+ f"{bitbake_dir} ({bitbake_rev})\n"
+ f"{oecore_dir} ({oecore_rev})")
+
# -- General configuration ---------------------------------------------------
# Prevent building with an outdated version of sphinx
@@ -46,6 +72,7 @@ needs_sphinx = "4.0"
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
# ones.
extensions = [
+ 'sphinx.ext.autodoc',
'sphinx.ext.autosectionlabel',
'sphinx.ext.extlinks',
'sphinx.ext.intersphinx',
@@ -101,6 +128,12 @@ manpages_url = 'https://manpages.debian.org/{path}'
# Suppress "WARNING: unknown mimetype for ..."
suppress_warnings = ['epub.unknown_project_files']
+# Unless, we're building the docs with the Autobuilder, suppress warnings from
+# the autodoc module, as it assumes openembedded-core and bitbake are cloned
+# in yocto-docs.
+if not os.getenv('AUTOBUILDER_BUILD', '0') == '1':
+ suppress_warnings.append('autodoc.import_object')
+
# We need XeTeX to process special unicode character, sometimes the contributor
# list from the release note contains those.
# See https://docs.readthedocs.io/en/stable/guides/pdf-non-ascii-languages.html.
--
2.56.0
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH 2/3] ref-manual/terms.rst: add the Datastore definition
2026-11-24 13:17 [PATCH 0/3] Add a "Library Functions" section to the ref-manual Antonin Godard
2026-11-24 13:17 ` [PATCH 1/3] conf.py: enable sphinx.ext.autodoc Antonin Godard
@ 2026-11-24 13:17 ` Antonin Godard
2026-11-24 13:17 ` [PATCH 3/3] ref-manual: add a Library Functions section Antonin Godard
2 siblings, 0 replies; 4+ messages in thread
From: Antonin Godard @ 2026-11-24 13:17 UTC (permalink / raw)
To: docs; +Cc: Thomas Petazzoni, Antonin Godard
To be able to use the reference in docstrings as :term:`datastore`, we
need to define it here in yocto-docs. We could have used
:term:`bitbake:datastore` but this felt too wordy - instead just set the
term here a link to the BitBake User Manual.
Signed-off-by: Antonin Godard <antonin.godard@bootlin.com>
---
documentation/ref-manual/terms.rst | 3 +++
1 file changed, 3 insertions(+)
diff --git a/documentation/ref-manual/terms.rst b/documentation/ref-manual/terms.rst
index ed507033d..7ace5a0f9 100644
--- a/documentation/ref-manual/terms.rst
+++ b/documentation/ref-manual/terms.rst
@@ -306,6 +306,9 @@ universal, the list includes them just in case:
Manual. You can also find more information on using the relocatable
toolchain in the :doc:`/sdk-manual/index` manual.
+ :term:`Datastore`
+ See the definition in the :term:`BitBake User Manual <bitbake:Datastore>`.
+
:term:`Extensible Software Development Kit (eSDK)`
A custom SDK for application developers. This eSDK allows developers to
incorporate their library and programming changes back into the image to
--
2.56.0
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH 3/3] ref-manual: add a Library Functions section
2026-11-24 13:17 [PATCH 0/3] Add a "Library Functions" section to the ref-manual Antonin Godard
2026-11-24 13:17 ` [PATCH 1/3] conf.py: enable sphinx.ext.autodoc Antonin Godard
2026-11-24 13:17 ` [PATCH 2/3] ref-manual/terms.rst: add the Datastore definition Antonin Godard
@ 2026-11-24 13:17 ` Antonin Godard
2 siblings, 0 replies; 4+ messages in thread
From: Antonin Godard @ 2026-11-24 13:17 UTC (permalink / raw)
To: docs; +Cc: Thomas Petazzoni, Antonin Godard
Like the BitBake User Manual[1], add a "Library Functions" section in
the documentation which uses the autodoc Sphinx extention to
auto-document useful modules of the oe library.
[1]: https://git.openembedded.org/bitbake/tree/doc/bitbake-user-manual/bitbake-user-manual-library-functions.rst
Signed-off-by: Antonin Godard <antonin.godard@bootlin.com>
---
documentation/ref-manual/index.rst | 1 +
documentation/ref-manual/library-functions.rst | 72 ++++++++++++++++++++++++++
2 files changed, 73 insertions(+)
diff --git a/documentation/ref-manual/index.rst b/documentation/ref-manual/index.rst
index aa1a63e05..6f02b0fc9 100644
--- a/documentation/ref-manual/index.rst
+++ b/documentation/ref-manual/index.rst
@@ -17,6 +17,7 @@ Yocto Project Reference Manual
structure
classes
tasks
+ library-functions
fragments
devtool-reference
kickstart
diff --git a/documentation/ref-manual/library-functions.rst b/documentation/ref-manual/library-functions.rst
new file mode 100644
index 000000000..6b075c55d
--- /dev/null
+++ b/documentation/ref-manual/library-functions.rst
@@ -0,0 +1,72 @@
+.. SPDX-License-Identifier: CC-BY-SA-2.0-UK
+
+=================
+Library Functions
+=================
+
+This chapter lists common library functions available under the
+:oecore_path:`meta/lib` directory in :term:`OpenEmbedded-Core (OE-Core)`.
+
+These functions can be used in recipes or configuration files with
+:ref:`inline-Python <bitbake:bitbake-user-manual/bitbake-user-manual-metadata:Inline
+Python Variable Expansion>` or :ref:`Python
+<bitbake:bitbake-user-manual/bitbake-user-manual-metadata:BitBake-Style Python
+Functions>` functions.
+
+``oe``
+======
+
+Reference documentation for modules in :oecore_path:`meta/lib/oe`.
+
+``oe.data``
+-----------
+
+.. automodule:: oe.data
+ :members:
+
+``oe.go``
+---------
+
+.. automodule:: oe.go
+ :members:
+
+``oe.kernel``
+-------------
+
+.. automodule:: oe.kernel
+ :members:
+
+``oe.lsb``
+----------
+
+.. automodule:: oe.lsb
+ :members:
+
+``oe.path``
+-----------
+
+.. automodule:: oe.path
+ :members:
+
+``oe.purl``
+-----------
+
+.. automodule:: oe.purl
+ :members:
+
+``oe.utils``
+------------
+
+.. automodule:: oe.utils
+ :members:
+
+``oe.types``
+------------
+
+.. automodule:: oe.types
+ :members:
+ boolean,
+ float,
+ integer,
+ path,
+ regex,
--
2.56.0
^ permalink raw reply related [flat|nested] 4+ messages in thread
end of thread, other threads:[~2026-11-24 13:18 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-24 13:17 [PATCH 0/3] Add a "Library Functions" section to the ref-manual Antonin Godard
2026-11-24 13:17 ` [PATCH 1/3] conf.py: enable sphinx.ext.autodoc Antonin Godard
2026-11-24 13:17 ` [PATCH 2/3] ref-manual/terms.rst: add the Datastore definition Antonin Godard
2026-11-24 13:17 ` [PATCH 3/3] ref-manual: add a Library Functions section Antonin Godard
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.