Bug 2250853

Summary: python-inkex fails to build with Python 3.13: AttributeError: module 'importlib.resources' has no attribute 'contents'
Product: [Fedora] Fedora Reporter: Karolina Surma <ksurma>
Component: python-inkexAssignee: Benson Muite <benson_muite>
Status: CLOSED RAWHIDE QA Contact:
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: rawhideCC: benson_muite, ksurma, mhroncok
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2023-12-24 05:23:26 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 2244836    

Description Karolina Surma 2023-11-21 12:49:39 UTC
python-inkex fails to build with Python 3.13.0a1.

Traceback (most recent call last):
  File "/usr/lib/rpm/redhat/import_all_modules.py", line 171, in <module>
    main()
  File "/usr/lib/rpm/redhat/import_all_modules.py", line 167, in main
    import_modules(modules)
  File "/usr/lib/rpm/redhat/import_all_modules.py", line 100, in import_modules
    importlib.import_module(module)
  File "/usr/lib64/python3.13/importlib/__init__.py", line 88, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "<frozen importlib._bootstrap>", line 1381, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1354, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1325, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 929, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 1010, in exec_module
  File "<frozen importlib._bootstrap>", line 488, in _call_with_frames_removed
  File "/builddir/build/BUILDROOT/python-inkex-1.3.0-1.fc40.x86_64/usr/lib/python3.13/site-packages/inkex/tester/inx.py", line 161, in <module>
    INX_SCHEMAS = dict(_load_inx_schemas())
                  ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/builddir/build/BUILDROOT/python-inkex-1.3.0-1.fc40.x86_64/usr/lib/python3.13/site-packages/inkex/tester/inx.py", line 150, in _load_inx_schemas
    for name in resources.contents(__package__):
                ^^^^^^^^^^^^^^^^^^
AttributeError: module 'importlib.resources' has no attribute 'contents'

The deprecated importlib.resources methods were removed from Python 3.13:
- contents()
- is_resource()
- open_binary()
- open_text()
- path()
- read_binary()
- read_text()
Use files() instead. Refer to importlib-resources: Migrating from Legacy for migration advice.
https://importlib-resources.readthedocs.io/en/latest/using.html#migrating-from-legacy


https://docs.python.org/3.13/whatsnew/3.13.html

For the build logs, see:
https://copr-be.cloud.fedoraproject.org/results/@python/python3.13/fedora-rawhide-x86_64/06674204-python-inkex/

For all our attempts to build python-inkex with Python 3.13, see:
https://copr.fedorainfracloud.org/coprs/g/python/python3.13/package/python-inkex/

Testing and mass rebuild of packages is happening in copr.
You can follow these instructions to test locally in mock if your package builds with Python 3.13:
https://copr.fedorainfracloud.org/coprs/g/python/python3.13/

Let us know here if you have any questions.

Python 3.13 is planned to be included in Fedora 41.
To make that update smoother, we're building Fedora packages with all pre-releases of Python 3.13.
A build failure prevents us from testing all dependent packages (transitive [Build]Requires),
so if this package is required a lot, it's important for us to get it fixed soon.

We'd appreciate help from the people who know this package best,
but if you don't want to work on this now, let us know so we can try to work around it on our side.

Comment 1 Benson Muite 2023-11-28 12:51:02 UTC
Raised issue upstream:
https://gitlab.com/inkscape/inbox/-/issues/9600
May need to create a workaround for Fedora and have it applied upstream when they are ready to support newer Python versions.

Comment 2 Karolina Surma 2023-12-22 10:27:18 UTC
I sent a PR upstream: https://gitlab.com/inkscape/extensions/-/merge_requests/608 - this builds with Python 3.13, as well as works with the older Pythons.