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

[BUG] cgi module is deprecated since Python 3.11.0b1 #3314

Closed
hrnciar opened this issue May 12, 2022 · 5 comments
Closed

[BUG] cgi module is deprecated since Python 3.11.0b1 #3314

hrnciar opened this issue May 12, 2022 · 5 comments
Labels
bug Needs Triage Issues that need to be evaluated for severity and status.

Comments

@hrnciar
Copy link

hrnciar commented May 12, 2022

setuptools version

60.9.3

Python version

3.11.0b1

OS

Fedora Rawhide

Additional environment information

No response

Description

Setuptools doesn't build with Python 3.11.0b1 due to DeprecationWarning.

Expected behavior

Setuptools builds with Python 3.11.0b1.

How to Reproduce

Build setuptools with Python 3.11.

Output

=================================== FAILURES ===================================
_____________________ TestSphinxUploadDocs.test_sphinx_doc _____________________

self = <setuptools.tests.test_sphinx_upload_docs.TestSphinxUploadDocs object at 0x7f6ca15ad550>

    def test_sphinx_doc(self):
        params = dict(
            packages=['test'],
        )
        dist = Distribution(params)
    
        cmd = upload_docs(dist)
    
        cmd.initialize_options()
        assert cmd.upload_dir is None
        assert cmd.has_sphinx() is True
>       cmd.finalize_options()

/builddir/build/BUILD/setuptools-60.9.3/setuptools/tests/test_sphinx_upload_docs.py:37: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/builddir/build/BUILD/setuptools-60.9.3/setuptools/command/upload_docs.py:63: in finalize_options
    build_sphinx = self.get_finalized_command('build_sphinx')
/builddir/build/BUILD/setuptools-60.9.3/setuptools/_distutils/cmd.py:298: in get_finalized_command
    cmd_obj = self.distribution.get_command_obj(command, create)
/builddir/build/BUILD/setuptools-60.9.3/setuptools/_distutils/dist.py:858: in get_command_obj
    klass = self.get_command_class(command)
/builddir/build/BUILD/setuptools-60.9.3/setuptools/dist.py:931: in get_command_class
    self.cmdclass[command] = cmdclass = ep.load()
/usr/lib64/python3.11/importlib/metadata/__init__.py:198: in load
    module = import_module(match.group('module'))
/usr/lib64/python3.11/importlib/__init__.py:126: in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
<frozen importlib._bootstrap>:1206: in _gcd_import
    ???
<frozen importlib._bootstrap>:1178: in _find_and_load
    ???
<frozen importlib._bootstrap>:1149: in _find_and_load_unlocked
    ???
<frozen importlib._bootstrap>:690: in _load_unlocked
    ???
<frozen importlib._bootstrap_external>:939: in exec_module
    ???
<frozen importlib._bootstrap>:241: in _call_with_frames_removed
    ???
/usr/lib/python3.11/site-packages/sphinx/setup_command.py:13: in <module>
    from sphinx.application import Sphinx
/usr/lib/python3.11/site-packages/sphinx/application.py:24: in <module>
    from sphinx.config import Config
/usr/lib/python3.11/site-packages/sphinx/config.py:14: in <module>
    from sphinx.util.i18n import format_date
/usr/lib/python3.11/site-packages/sphinx/util/i18n.py:10: in <module>
    from babel.messages.mofile import write_mo
/usr/lib/python3.11/site-packages/babel/messages/__init__.py:12: in <module>
    from babel.messages.catalog import *
/usr/lib/python3.11/site-packages/babel/messages/catalog.py:14: in <module>
    from cgi import parse_header
/usr/lib64/python3.11/cgi.py:57: in <module>
    warnings._deprecated(__name__, remove=(3,13))
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

name = 'cgi'
message = '{name!r} is deprecated and slated for removal in Python {remove}'

    def _deprecated(name, message=_DEPRECATED_MSG, *, remove, _version=sys.version_info):
        """Warn that *name* is deprecated or should be removed.
    
        RuntimeError is raised if *remove* specifies a major/minor tuple older than
        the current Python version or the same version but past the alpha.
    
        The *message* argument is formatted with *name* and *remove* as a Python
        version (e.g. "3.11").
    
        """
        remove_formatted = f"{remove[0]}.{remove[1]}"
        if (_version[:2] > remove) or (_version[:2] == remove and _version[3] != "alpha"):
            msg = f"{name!r} was slated for removal after Python {remove_formatted} alpha"
            raise RuntimeError(msg)
        else:
            msg = message.format(name=name, remove=remove_formatted)
>           warn(msg, DeprecationWarning, stacklevel=3)
E           DeprecationWarning: 'cgi' is deprecated and slated for removal in Python 3.13

/usr/lib64/python3.11/warnings.py:514: DeprecationWarning
@hrnciar hrnciar added bug Needs Triage Issues that need to be evaluated for severity and status. labels May 12, 2022
@hroncok
Copy link
Contributor

hroncok commented May 12, 2022

FTR this appears to be fixed in python-babel/babel#876

@abravalheri
Copy link
Contributor

abravalheri commented May 12, 2022

Hi @hrnciar thank you for reporting this, and thank you Miro for pointing the existing fix.

Even when an old version of babel is used, the solution seems to be very simple: modify pytest.ini to ignore this deprecation warning. However this test no longer exists in the latest versions of setuptools, and I have the impression that setuptools does not provide fix releases for old versions. So I am not sure how to proceed...

(Considering that sphinx does not cap a version of babel, it seems likely that the issue will be fixed once the changes pointed out by Miro are released.
A different approach would be skipping this test, since upload_docs is deprecated by sphinx).

@hroncok
Copy link
Contributor

hroncok commented May 12, 2022

I see that 19bfd4d is included in 60.10.0+

@hrnciar
Copy link
Author

hrnciar commented May 12, 2022

Hello, thank you for the response and the explanation.

So I am not sure how to proceed...

I didn't know that the problematic test was already removed from setuptools. I think this issue can be closed and we can handle it on Fedora's side (either skipping the test or fixing babel).

@hroncok
Copy link
Contributor

hroncok commented May 12, 2022

either skipping the test or fixing babel

or updating setuptools

@hrnciar hrnciar closed this as completed May 12, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Needs Triage Issues that need to be evaluated for severity and status.
Projects
None yet
Development

No branches or pull requests

3 participants