Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DeprecationWarning: 'cgi' is deprecated and slated for removal in Python 3.13 #437

Open
jugmac00 opened this issue May 29, 2022 · 6 comments

Comments

@jugmac00
Copy link

jugmac00 commented May 29, 2022

git clone https://github.com/morepath/morepath
cd morepath
tox -e py311

...

.tox/py311/lib/python3.11/site-packages/webob/compat.py:5
  /home/jugmac00/Projects/my-all-repos/output_zope/morepath/morepath/.tox/py311/lib/python3.11/site-packages/webob/compat.py:5: DeprecationWarning: 'cgi' is deprecated and slated for removal in Python 3.13
    from cgi import parse_header

Also see:
https://peps.python.org/pep-0594/#cgi

And yes I know - it will take a couple of years until anybody will use 3.14 :-)

Anyhow, seeing the same deprecation warnings with every test run is slightly annoying. If you are ok with the suggested replacement (see pep), I'd create a PR.

@mmerickel
Copy link
Member

webob has bigger problems with cgi than just the parse_header method but that being said I don’t see a big problem with the suggested fix. I would require a little due diligence to ensure that they are actually compatible apis.

Bitter rant: due diligence because the pep isn’t very trustworthy in its analyses from the perspective of the maintainer of a very popular library that’s apparently using a library so unpopular that it’s getting dropped from the stdlib.

@ondrejj
Copy link

ondrejj commented Oct 23, 2023

Any update for this issue?

Reported in red hat bugzilla:
https://bugzilla.redhat.com/show_bug.cgi?id=2245641

@ztane
Copy link

ztane commented Dec 13, 2023

The title could now be changed to "ImportError: no such module cgi" :'D

@ztane
Copy link

ztane commented Dec 13, 2023

Anyway, the cgi.py of 3.11 at least, contains ~1k lines in one file, of which ~700 lines are actually relevant, there is some unbelievable CGI html output garbage and some logging methods so I can understand why people want it gone, is it license-wise possible to vendor the 3.11 / 3.12 version into WebOb compat?

And with all due respect to Martijn for proposing those replacements; those replacement strategies are already in use in cgi.py as far as I can see and what remains... are those 700 lines of code.

@spiqueras
Copy link

In case there's interest, I've tested installing the legacy-cgi package with Python 3.13.0a3 and all tests pass. Branch is here: https://github.com/spiqueras/webob/tree/py3.13

@mgorny
Copy link

mgorny commented May 18, 2024

Python 3.13.0b1 is out, and the cgi removal is "official" now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants