Bug 2245641 - python-webob fails to build with Python 3.13: ModuleNotFoundError: No module named 'cgi'
Summary: python-webob fails to build with Python 3.13: ModuleNotFoundError: No module ...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Fedora
Classification: Fedora
Component: python-webob
Version: 40
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Fedora Infrastructure SIG
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
: 2291971 (view as bug list)
Depends On:
Blocks: PYTHON3.13 2291481 2291493 2291601 2291629 2291630 2291634 2291658 2291752 2291807 2291813 2291822 2291824 2291826 2291838 2291872 2291873 2291874 2291875 2291876 2291898 2291903 2291914 2291959 2291960
TreeView+ depends on / blocked
 
Reported: 2023-10-23 12:04 UTC by Karolina Surma
Modified: 2024-06-19 23:50 UTC (History)
10 users (show)

Fixed In Version: python-webob-1.8.7-13.fc41 python-webob-1.8.7-14.fc41
Clone Of:
Environment:
Last Closed: 2024-06-15 06:44:23 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Github Pylons webob issues 437 0 None open DeprecationWarning: 'cgi' is deprecated and slated for removal in Python 3.13 2023-10-23 12:32:49 UTC

Description Karolina Surma 2023-10-23 12:04:45 UTC
python-webob fails to build with Python 3.13.0a1.

_____________________ ERROR collecting tests/test_util.py ______________________
ImportError while importing test module '/builddir/build/BUILD/WebOb-1.8.7/tests/test_util.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
/usr/lib64/python3.13/importlib/__init__.py:88: in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
tests/test_util.py:2: in <module>
    from webob.response import Response
../../BUILDROOT/python-webob-1.8.7-9.fc40.x86_64/usr/lib/python3.13/site-packages/webob/__init__.py:1: in <module>
    from webob.datetime_utils import (  # noqa: F401
../../BUILDROOT/python-webob-1.8.7-9.fc40.x86_64/usr/lib/python3.13/site-packages/webob/datetime_utils.py:18: in <module>
    from webob.compat import (
../../BUILDROOT/python-webob-1.8.7-9.fc40.x86_64/usr/lib/python3.13/site-packages/webob/compat.py:5: in <module>
    from cgi import parse_header
E   ModuleNotFoundError: No module named 'cgi'
=========================== short test summary info ============================
ERROR tests/test_acceptparse.py
ERROR tests/test_byterange.py
ERROR tests/test_client_functional.py
ERROR tests/test_compat.py
ERROR tests/test_cookies.py
ERROR tests/test_cookies_bw.py
ERROR tests/test_datetime_utils.py
ERROR tests/test_dec.py
ERROR tests/test_descriptors.py
ERROR tests/test_etag.py
ERROR tests/test_etag_nose.py
ERROR tests/test_exc.py
ERROR tests/test_headers.py
ERROR tests/test_in_wsgiref.py
ERROR tests/test_misc.py
ERROR tests/test_multidict.py
ERROR tests/test_request.py
ERROR tests/test_response.py
ERROR tests/test_static.py
ERROR tests/test_transcode.py
ERROR tests/test_util.py
!!!!!!!!!!!!!!!!!!! Interrupted: 21 errors during collection !!!!!!!!!!!!!!!!!!!
============================== 21 errors in 2.20s ==============================


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

PEP 594: Remove the cgi and cgitb modules, deprecated in Python 3.11.

cgi.FieldStorage can typically be replaced with urllib.parse.parse_qsl() for GET and HEAD requests, and the email.message module or multipart PyPI project for POST and PUT.

cgi.parse() can be replaced by calling urllib.parse.parse_qs() directly on the desired query string, except for multipart/form-data input, which can be handled as described for cgi.parse_multipart().

cgi.parse_multipart() can be replaced with the functionality in the email package (e.g. email.message.EmailMessage and email.message.Message) which implements the same MIME RFCs, or with the multipart PyPI project.

cgi.parse_header() can be replaced with the functionality in the email package, which implements the same MIME RFCs. For example, with email.message.EmailMessage:

from email.message import EmailMessage
msg = EmailMessage()
msg['content-type'] = 'application/json; charset="utf8"'
main, params = msg.get_content_type(), msg['content-type'].params

(Contributed by Victor Stinner in gh-104773.)


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/06546847-python-webob/

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

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 Jan ONDREJ 2023-10-23 12:32:49 UTC
Already reported upstream, but without fix.

Comment 2 Aoife Moloney 2024-02-15 23:00:20 UTC
This bug appears to have been reported against 'rawhide' during the Fedora Linux 40 development cycle.
Changing version to 40.

Comment 3 Ben Beasley 2024-06-01 11:51:20 UTC
Tracking this because python-webob is a dependency for python-webtest, which is a test dependency for python-wsgidav. I’m patching out the dependency and the affected tests for now.

Comment 4 Adam Williamson 2024-06-11 19:19:13 UTC
mhroncok says this also blocks beaker, and through a dumb depchain (rhythmbox requires python3-mako, python3-mako recommends python3-beaker), python3-beaker is in a default Workstation install. This is a bit of a problem for the Python 3.13 rebuild process as it means anyone with rhythmbox installed will have to use --allowerasing or manually remove python3-beaker in order to get to 3.13.

Comment 5 Miro Hrončok 2024-06-11 22:56:49 UTC
(In reply to Adam Williamson from comment #4)
> mhroncok says this also blocks beaker, and through a dumb depchain
> (rhythmbox requires python3-mako, python3-mako recommends python3-beaker),
> python3-beaker is in a default Workstation install. This is a bit of a
> problem for the Python 3.13 rebuild process as it means anyone with
> rhythmbox installed will have to use --allowerasing or manually remove
> python3-beaker in order to get to 3.13.

As a workaround, I added Obsoletes for python3-beaker < 1.12.1-6 to fedora-obsolete-packages. Once python-beaker is built with Python 3.13, it will no longer be < 1.12.1-6 and the Obsoletes will no longer matter.

Anyway, python-beaker needs python-webob through python-webtest and that dependency can be removed by skipping tests/test_managers/test_ext_redis.py. Unfortunately, other tests fail when that is done.

Once the Python 3.13 side tag is merged, python3-beaker will get a FailsToInstall bugzilla and I can add more details there.

Comment 6 Jan ONDREJ 2024-06-12 06:18:07 UTC
There is a legacy-cgi module on pypi:
  https://pypi.org/project/legacy-cgi/

According to this issue it's working well with legacy-cgi:
  https://github.com/Pylons/webob/issues/437

Do you think, we should add python-legacy-cgi package to Fedora?

Comment 7 Miro Hrončok 2024-06-12 07:17:12 UTC
> Do you think, we should add python-legacy-cgi package to Fedora?

The project looks reasonably well-forked and does not say it's an "unmaintained dump of the code from CPython" (like other such packages do). I don't see why not.

Comment 8 Karolina Surma 2024-06-12 15:09:46 UTC
*** Bug 2291971 has been marked as a duplicate of this bug. ***

Comment 9 Miro Hrončok 2024-06-12 15:13:49 UTC
> Once the Python 3.13 side tag is merged, python3-beaker will get a FailsToInstall bugzilla and I can add more details there.

See bz2291634.

Comment 10 Mattia Verga 2024-06-14 10:07:22 UTC
As I didn't find any package submission about legacy-cgi I moved forward and submitted https://bugzilla.redhat.com/show_bug.cgi?id=2292378

Comment 11 Mattia Verga 2024-06-14 17:02:20 UTC
I've pushed python-legacy-cgi to F41 and added proper buildrequire to webob. Build is running.

Comment 12 Fedora Update System 2024-06-14 17:08:20 UTC
FEDORA-2024-786643fad4 (python-webob-1.8.7-13.fc41) has been submitted as an update to Fedora 41.
https://bodhi.fedoraproject.org/updates/FEDORA-2024-786643fad4

Comment 13 Fedora Update System 2024-06-14 17:11:25 UTC
FEDORA-2024-786643fad4 (python-webob-1.8.7-13.fc41) has been pushed to the Fedora 41 stable repository.
If problem still persists, please make note of it in this bug report.

Comment 14 Miro Hrončok 2024-06-14 21:10:16 UTC
Considering where the import is:


/usr/lib/python3.13/site-packages/webob/compat.py:5: in <module>
    from cgi import parse_header


This should be required on runtime as well.

Comment 15 Fedora Update System 2024-06-15 06:42:10 UTC
FEDORA-2024-340c303ca3 (python-webob-1.8.7-14.fc41) has been submitted as an update to Fedora 41.
https://bodhi.fedoraproject.org/updates/FEDORA-2024-340c303ca3

Comment 16 Fedora Update System 2024-06-15 06:44:23 UTC
FEDORA-2024-340c303ca3 (python-webob-1.8.7-14.fc41) has been pushed to the Fedora 41 stable repository.
If problem still persists, please make note of it in this bug report.

Comment 17 Fedora Update System 2024-06-19 23:47:08 UTC
FEDORA-2024-6a1978a844 (python-pyngus-2.3.0^20200513git60b6f10-5.20200513git60b6f10.fc41) has been submitted as an update to Fedora 41.
https://bodhi.fedoraproject.org/updates/FEDORA-2024-6a1978a844

Comment 18 Fedora Update System 2024-06-19 23:50:25 UTC
FEDORA-2024-6a1978a844 (python-pyngus-2.3.0^20200513git60b6f10-5.20200513git60b6f10.fc41) has been pushed to the Fedora 41 stable repository.
If problem still persists, please make note of it in this bug report.


Note You need to log in before you can comment on or make changes to this bug.