Bug 2271056

Summary: python-latexcodec fails to build with Python 3.13: AttributeError: module 'importlib.resources' has no attribute 'open_text'
Product: [Fedora] Fedora Reporter: Karolina Surma <ksurma>
Component: python-latexcodecAssignee: Jerry James <loganjerry>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: rawhideCC: ksurma, loganjerry, mhroncok
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: python-latexcodec-3.0.0-3.fc41 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2024-03-22 15:47:18 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 2024-03-22 12:42:38 UTC
python-latexcodec fails to build with Python 3.13.0a5.

+ /usr/bin/pytest
============================= test session starts ==============================
platform linux -- Python 3.13.0a5, pytest-7.4.3, pluggy-1.3.0
rootdir: /builddir/build/BUILD/latexcodec-3.0.0
collected 75 items / 1 error

==================================== ERRORS ====================================
__________________ ERROR collecting test/test_latex_codec.py ___________________
/usr/lib/python3.13/site-packages/_pytest/runner.py:341: in from_call
    result: Optional[TResult] = func()
/usr/lib/python3.13/site-packages/_pytest/runner.py:372: in <lambda>
    call = CallInfo.from_call(lambda: list(collector.collect()), "collect")
/usr/lib/python3.13/site-packages/_pytest/python.py:531: in collect
    self._inject_setup_module_fixture()
/usr/lib/python3.13/site-packages/_pytest/python.py:545: in _inject_setup_module_fixture
    self.obj, ("setUpModule", "setup_module")
/usr/lib/python3.13/site-packages/_pytest/python.py:310: in obj
    self._obj = obj = self._getobj()
/usr/lib/python3.13/site-packages/_pytest/python.py:528: in _getobj
    return self._importtestmodule()
/usr/lib/python3.13/site-packages/_pytest/python.py:617: in _importtestmodule
    mod = import_path(self.path, mode=importmode, root=self.config.rootpath)
/usr/lib/python3.13/site-packages/_pytest/pathlib.py:567: in import_path
    importlib.import_module(module_name)
/usr/lib64/python3.13/importlib/__init__.py:88: in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
<frozen importlib._bootstrap>:1387: in _gcd_import
    ???
<frozen importlib._bootstrap>:1360: in _find_and_load
    ???
<frozen importlib._bootstrap>:1331: in _find_and_load_unlocked
    ???
<frozen importlib._bootstrap>:935: in _load_unlocked
    ???
/usr/lib/python3.13/site-packages/_pytest/assertion/rewrite.py:186: in exec_module
    exec(co, module.__dict__)
test/test_latex_codec.py:12: in <module>
    import latexcodec
../../BUILDROOT/python-latexcodec-3.0.0-1.fc41.x86_64/usr/lib/python3.13/site-packages/latexcodec/__init__.py:1: in <module>
    import latexcodec.codec
../../BUILDROOT/python-latexcodec-3.0.0-1.fc41.x86_64/usr/lib/python3.13/site-packages/latexcodec/codec.py:218: in <module>
    _LATEX_UNICODE_TABLE = LatexUnicodeTable(lexer.LatexIncrementalDecoder())
../../BUILDROOT/python-latexcodec-3.0.0-1.fc41.x86_64/usr/lib/python3.13/site-packages/latexcodec/codec.py:126: in __init__
    self.register_all()
../../BUILDROOT/python-latexcodec-3.0.0-1.fc41.x86_64/usr/lib/python3.13/site-packages/latexcodec/codec.py:149: in register_all
    for trans in load_unicode_latex_table():
../../BUILDROOT/python-latexcodec-3.0.0-1.fc41.x86_64/usr/lib/python3.13/site-packages/latexcodec/codec.py:102: in load_unicode_latex_table
    with pkg_resources.open_text('latexcodec', 'table.txt') as datafile:
E   AttributeError: module 'importlib.resources' has no attribute 'open_text'
=========================== short test summary info ============================
ERROR test/test_latex_codec.py - AttributeError: module 'importlib.resources'...
!!!!!!!!!!!!!!!!!!!! Interrupted: 1 error during collection !!!!!!!!!!!!!!!!!!!!
=============================== 1 error in 0.15s ===============================

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/07197812-python-latexcodec/

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

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 Fedora Update System 2024-03-22 15:43:18 UTC
FEDORA-2024-dac3ae19c6 (python-latexcodec-3.0.0-3.fc41) has been submitted as an update to Fedora 41.
https://bodhi.fedoraproject.org/updates/FEDORA-2024-dac3ae19c6

Comment 2 Fedora Update System 2024-03-22 15:47:18 UTC
FEDORA-2024-dac3ae19c6 (python-latexcodec-3.0.0-3.fc41) has been pushed to the Fedora 41 stable repository.
If problem still persists, please make note of it in this bug report.