<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugzilla.yoctoproject.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.6"
          urlbase="https://bugzilla.yoctoproject.org/"
          
          maintainer="it-coreprojects-helpdesk@linuxfoundation.org"
>

    <bug>
          <bug_id>15977</bug_id>
          
          <creation_ts>2025-09-22 17:09:58 +0000</creation_ts>
          <short_desc>python-core: importlib.metadata RDEPENDS on several other packages</short_desc>
          <delta_ts>2026-11-10 14:46:49 +0000</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>7</classification_id>
          <classification>Build System, Metadata &amp; Runtime</classification>
          <product>OE-Core</product>
          <component>devtools / tool chain</component>
          <version>5.0.15</version>
          <rep_platform>x86</rep_platform>
          <op_sys>Multiple</op_sys>
          <bug_status>NEW</bug_status>
          <resolution></resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>Medium+</priority>
          <bug_severity>normal</bug_severity>
          <target_milestone>6.2</target_milestone>
          <dependson>16019</dependson>
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Colin McAllister">colinmca242</reporter>
          <assigned_to name="Colin McAllister">colinmca242</assigned_to>
          <cc>ccasciato</cc>
    
    <cc>meta.mr.watcher</cc>
    
    <cc>meta.watcher</cc>
    
    <cc>randy.macleod</cc>
    
    <cc>richard.purdie</cc>
    
    <cc>ross.burton</cc>
    
    <cc>tgamblin</cc>
    
    <cc>tim.orling</cc>
          
          
          <cf_os>---</cf_os>
          <cf_regression_type>---</cf_regression_type>
          
          <cf_docchange>No (bug/feature does not impact docs)</cf_docchange>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>102803</commentid>
    <comment_count>0</comment_count>
    <who name="Colin McAllister">colinmca242</who>
    <bug_when>2025-09-22 17:09:58 +0000</bug_when>
    <thetext>importlib.metadata, provided by python3-core, contains several imports that are not contained within python3-core, but are provided by separate packages. This issue has been found both on Kirkstone and Scarthgap.

The two imports that stick out are &quot;import email&quot; (provided by python3-email) and &quot;import zipfile&quot; (provided by python3-compression). I found this by hitting import errors for import zipfile on some builds that use a native python3 module that includes &quot;import importlib.metadata&quot;.

I would think a remediation would be to pull out importlib.metadata into a separate module and add the proper runtime dependencies, however there already exists a python3-importlib-metadata recipe provided by meta-python in meta-oe, for limited Yocto versions that uses the name. This package pulls in the separate importlib-metadata package that isn&apos;t provided in the Python stdlib and uses the &quot;importlib_metadata&quot; namespace instead of &quot;importlib.metadata&quot;.

# References
## cpython source:
https://github.com/python/cpython/blob/3.10/Lib/importlib/metadata/__init__.py
https://github.com/python/cpython/blob/3.12/Lib/importlib/metadata/__init__.py

## kirkstone configs:
core: https://git.yoctoproject.org/poky/tree/meta/recipes-devtools/python/python3/python3-manifest.json?h=kirkstone#n248
zipfile: https://git.yoctoproject.org/poky/tree/meta/recipes-devtools/python/python3/python3-manifest.json?h=kirkstone#n192
email: https://git.yoctoproject.org/poky/tree/meta/recipes-devtools/python/python3/python3-manifest.json?h=kirkstone#n591

## Scarthgap configs:
core: https://git.yoctoproject.org/poky/tree/meta/recipes-devtools/python/python3/python3-manifest.json?h=scarthgap#n266
zipfile: https://git.yoctoproject.org/poky/tree/meta/recipes-devtools/python/python3/python3-manifest.json?h=scarthgap#n209
email: https://git.yoctoproject.org/poky/tree/meta/recipes-devtools/python/python3/python3-manifest.json?h=scarthgap#n602

## Existing python3-importlib-metadata-package
https://layers.openembedded.org/layerindex/recipe/414799/</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>102819</commentid>
    <comment_count>1</comment_count>
    <who name="Randy MacLeod">randy.macleod</who>
    <bug_when>2025-09-25 14:38:37 +0000</bug_when>
    <thetext>Colin, 

Notes from the YP bug review meeting...

Does this happen on the master branch?

The history is that we have granular control of importing but
sometimes, we miss upstream changes.

Specifically email and zipfile do seem odd.
How big are those modules and what are their dependencies?

Python has a tool to check for correct dependencies. Ross is going to dig up some info and share it here.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>102823</commentid>
    <comment_count>2</comment_count>
    <who name="Tim Orling">tim.orling</who>
    <bug_when>2025-09-25 14:54:04 +0000</bug_when>
    <thetext>The fix will probably need to be in the python3 manifest file.

email:
https://git.openembedded.org/openembedded-core/tree/meta/recipes-devtools/python/python3/python3-manifest.json#n563

zlib (in the python3-core subpackage):
https://git.openembedded.org/openembedded-core/tree/meta/recipes-devtools/python/python3/python3-manifest.json#n267

I&apos;m not seeing importlib/metadata path in the manifest, so more digging is required.


What is happening in upstream python ecosystem is that a lot of the stdlib and other core tools are being developed externally, in other repositories. It is getting harder and harder to follow those changes and threads in a casual manner...

We could also probably do with some more scrutiny on updates to python3 and the impact on the manifest file.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>102832</commentid>
    <comment_count>3</comment_count>
    <who name="Tim Orling">tim.orling</who>
    <bug_when>2025-09-25 16:52:17 +0000</bug_when>
    <thetext>Just as an experiment with latest **master**:
core-image-minimal with IMAGE_INSTALL:append = &quot; python3-core&quot;

root@qemux86-64:~# python3
Python 3.13.7 (main, Aug 14 2025, 11:12:11) [GCC 15.2.0] on linux
Type &quot;help&quot;, &quot;copyright&quot;, &quot;credits&quot; or &quot;license&quot; for more information.
warning: can&apos;t use pyrepl: No module named &apos;msvcrt&apos;
&gt;&gt;&gt; import importlib.metadata
Traceback (most recent call last):
  File &quot;&lt;stdin&gt;&quot;, line 1, in &lt;module&gt;
    import importlib.metadata
  File &quot;/usr/lib/python3.13/importlib/metadata/__init__.py&quot;, line 7, in &lt;module&gt;
    import json
ModuleNotFoundError: No module named &apos;json&apos;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>102836</commentid>
    <comment_count>4</comment_count>
    <who name="Ross Burton">ross.burton</who>
    <bug_when>2025-09-26 11:04:29 +0000</bug_when>
    <thetext>Stuff like the failure Tim pointed out is exactly why I&apos;m a fan of revisiting the package splitting entirely.  I&apos;m thinking it&apos;s worth seeing if there&apos;s just a few large modules that can be split out to keep the bulk of the standard library in &quot;core&quot; because there&apos;s just so much use between parts.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>102992</commentid>
    <comment_count>5</comment_count>
    <who name="Ross Burton">ross.burton</who>
    <bug_when>2025-10-17 16:42:15 +0000</bug_when>
    <thetext>Filed https://bugzilla.yoctoproject.org/show_bug.cgi?id=16019 about revisiting the split.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>105718</commentid>
    <comment_count>6</comment_count>
    <who name="Richard Purdie">richard.purdie</who>
    <bug_when>2026-06-04 15:21:20 +0000</bug_when>
    <thetext>I suspect the meta-oe module is no longer relevant to us and can be dropped. That would let us package the core separately and resolve the issue?

As Ross says, there are other issues too but we can take this step by step...</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>