Bug 2440552 - python-setuptools fails to build with Python 3.15: DeprecationWarning: '__version__' is deprecated and slated for removal in Python 3.20
Summary: python-setuptools fails to build with Python 3.15: DeprecationWarning: '__ver...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Fedora
Classification: Fedora
Component: python-setuptools
Version: rawhide
Hardware: Unspecified
OS: Linux
unspecified
medium
Target Milestone: ---
Assignee: Miro Hrončok
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks: PYTHON3.15
TreeView+ depends on / blocked
 
Reported: 2026-02-18 09:53 UTC by Karolina Surma
Modified: 2026-03-10 13:24 UTC (History)
5 users (show)

Fixed In Version: python-setuptools-80.10.2-2.fc45
Clone Of:
Environment:
Last Closed: 2026-03-10 13:24:56 UTC
Type: ---
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Fedora Package Sources python-setuptools pull-request 137 0 None None None 2026-03-09 14:22:50 UTC
Github pypa setuptools issues 5186 0 None open json.__version__ is deprecated 2026-02-18 12:37:49 UTC
Github pypa setuptools pull 5194 0 None Merged Avoid using (deprecated) `json.__version__` in tests 2026-03-09 14:03:01 UTC

Description Karolina Surma 2026-02-18 09:53:24 UTC
With Python 3.15.0a6, the older __version__ way of getting a version is deprecated:

________________________ TestDepends.testModuleExtract _________________________

self = <setuptools.tests.test_setuptools.TestDepends object at 0x7f07b8dda060>

    @needs_bytecode
    def testModuleExtract(self):
>       from json import __version__

/builddir/build/BUILD/python-setuptools-80.10.2-build/setuptools-80.10.2/setuptools/tests/test_setuptools.py:82: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
<frozen importlib._bootstrap>:1336: in _handle_fromlist
    ???
/usr/lib64/python3.15/json/__init__.py:371: in __getattr__
    _deprecated("__version__", remove=(3, 20))
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

name = '__version__'
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 tuple (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)
>           _wm.warn(msg, DeprecationWarning, stacklevel=3)
E           DeprecationWarning: '__version__' is deprecated and slated for removal in Python 3.20

/usr/lib64/python3.15/_py_warnings.py:889: DeprecationWarning
___________________________ TestDepends.testRequire ____________________________

self = <setuptools.tests.test_setuptools.TestDepends object at 0x7f07b8dd9f30>

    @needs_bytecode
    def testRequire(self):
        req = Require('Json', '1.0.3', 'json')
    
        assert req.name == 'Json'
        assert req.module == 'json'
        assert req.requested_version == Version('1.0.3')
        assert req.attribute == '__version__'
        assert req.full_name() == 'Json-1.0.3'
    
>       from json import __version__

/builddir/build/BUILD/python-setuptools-80.10.2-build/setuptools-80.10.2/setuptools/tests/test_setuptools.py:101: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
<frozen importlib._bootstrap>:1336: in _handle_fromlist
    ???
/usr/lib64/python3.15/json/__init__.py:371: in __getattr__
    _deprecated("__version__", remove=(3, 20))
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

name = '__version__'
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 tuple (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)
>           _wm.warn(msg, DeprecationWarning, stacklevel=3)
E           DeprecationWarning: '__version__' is deprecated and slated for removal in Python 3.20

/usr/lib64/python3.15/_py_warnings.py:889: DeprecationWarning
=========================== short test summary info ============================
FAILED setuptools/tests/test_setuptools.py::TestDepends::testModuleExtract - ...
FAILED setuptools/tests/test_setuptools.py::TestDepends::testRequire - Deprec...

Reproducible: Always

Comment 1 Miro Hrončok 2026-02-18 12:37:49 UTC
Reported to upstream: https://github.com/pypa/setuptools/issues/5186

While at it, we might as well send a fixer.

Comment 2 Miro Hrončok 2026-02-18 13:05:33 UTC
A fox won't be trivial. See my comment in https://github.com/pypa/setuptools/issues/5186#issuecomment-3920663105

Comment 3 Miro Hrončok 2026-03-09 14:03:02 UTC
Fix in https://github.com/pypa/setuptools/pull/5194

Comment 5 Fedora Update System 2026-03-10 09:00:24 UTC
FEDORA-2026-817706e683 (python-setuptools-80.10.2-2.fc45) has been submitted as an update to Fedora 45.
https://bodhi.fedoraproject.org/updates/FEDORA-2026-817706e683

Comment 6 Fedora Update System 2026-03-10 13:24:56 UTC
FEDORA-2026-817706e683 (python-setuptools-80.10.2-2.fc45) has been pushed to the Fedora 45 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.