Bug 2189449

Summary: python-semver fails to build with Python 3.12: OrderedDict dict/list representation has changed and breaks tests
Product: [Fedora] Fedora Reporter: Tomáš Hrnčiar <thrnciar>
Component: python-semverAssignee: Ali Erdinc Koroglu <aekoroglu>
Status: CLOSED CURRENTRELEASE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 39CC: aekoroglu, code, igor.raits, mhroncok, projects.rg, thrnciar
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2024-07-05 23:47:43 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: 2135404    

Description Tomáš Hrnčiar 2023-04-25 09:49:59 UTC
python-semver fails to build with Python 3.12.0a7.

=================================== FAILURES ===================================
_____________________ [doctest] semver.VersionInfo._asdict _____________________
EXAMPLE LOCATION UNKNOWN, not showing all tests of that example
??? >>> semver.VersionInfo(3, 2, 1).to_dict()
Differences (ndiff with -expected +actual):
    - OrderedDict([('major', 3), ('minor', 2), ('patch', 1), ('prerelease', None), ('build', None)])
    ?             ^^         -----         -----         -----            ^     -  -       ^     ^^
    + OrderedDict({'major': 3, 'minor': 2, 'patch': 1, 'prerelease': None, 'build': None})
    ?             ^       +++         +++         +++              ^              ^     ^

/builddir/build/BUILD/python-semver-2.13.0/semver.py:None: DocTestFailure
_____________________ [doctest] semver.VersionInfo.to_dict _____________________
331 
332         .. versionadded:: 2.10.0
333            Renamed ``VersionInfo._asdict`` to ``VersionInfo.to_dict`` to
334            make this function available in the public API.
335 
336         :return: an OrderedDict with the keys in the order ``major``, ``minor``,
337           ``patch``, ``prerelease``, and ``build``.
338         :rtype: :class:`collections.OrderedDict`
339 
340         >>> semver.VersionInfo(3, 2, 1).to_dict()
Differences (ndiff with -expected +actual):
    - OrderedDict([('major', 3), ('minor', 2), ('patch', 1), ('prerelease', None), ('build', None)])
    ?             ^^         -----         -----         -----            ^     -  -       ^     ^^
    + OrderedDict({'major': 3, 'minor': 2, 'patch': 1, 'prerelease': None, 'build': None})
    ?             ^       +++         +++         +++              ^              ^     ^

/builddir/build/BUILD/python-semver-2.13.0/semver.py:340: DocTestFailure
_____________________________ [doctest] usage.rst ______________________________
102   In some cases you only need a string from your version data::
103 
104     >>> semver.format_version(3, 4, 5, 'pre.2', 'build.4')
105     '3.4.5-pre.2+build.4'
106 
107 * From a string into a dictionary
108 
109   To access individual parts, you can use the function :func:`semver.parse`::
110 
111     >>> semver.parse("3.4.5-pre.2+build.4")
Differences (ndiff with -expected +actual):
    - OrderedDict([('major', 3), ('minor', 4), ('patch', 5), ('prerelease', 'pre.2'), ('build', 'build.4')])
    ?             ^^         -----         -----         -----            ^        -  -       ^          ^^
    + OrderedDict({'major': 3, 'minor': 4, 'patch': 5, 'prerelease': 'pre.2', 'build': 'build.4'})
    ?             ^       +++         +++         +++              ^                 ^          ^

/builddir/build/BUILD/python-semver-2.13.0/docs/usage.rst:111: DocTestFailure
=========================== short test summary info ============================
FAILED semver.py::semver.VersionInfo._asdict
FAILED semver.py::semver.VersionInfo.to_dict
FAILED docs/usage.rst::usage.rst
======================== 3 failed, 316 passed in 0.45s =========================

gh-101446: Change repr of collections.OrderedDict to use regular dictionary formating instead of pairs of keys and values.
https://github.com/python/cpython/issues/101446
https://docs.python.org/3.12/whatsnew/3.12.html

For the build logs, see:
https://copr-be.cloud.fedoraproject.org/results/@python/python3.12/fedora-rawhide-x86_64/05840796-python-semver/

For all our attempts to build python-semver with Python 3.12, see:
https://copr.fedorainfracloud.org/coprs/g/python/python3.12/package/python-semver/

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.12:
https://copr.fedorainfracloud.org/coprs/g/python/python3.12/

Let us know here if you have any questions.

Python 3.12 is planned to be included in Fedora 39. To make that update smoother, we're building Fedora packages with all pre-releases of Python 3.12.
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 Release Engineering 2023-08-16 07:13:36 UTC
This bug appears to have been reported against 'rawhide' during the Fedora Linux 39 development cycle.
Changing version to 39.

Comment 2 Ben Beasley 2024-07-05 23:47:43 UTC
This was patched downstream, and is fixed upstream in 3.0.2 (https://src.fedoraproject.org/rpms/python-semver/pull-request/8).