Bug 2266593

Summary: python-nibabel fails to build with Python 3.13: Docstring indentation is now stripped by compiler
Product: [Fedora] Fedora Reporter: Karolina Surma <ksurma>
Component: python-nibabelAssignee: Ankur Sinha (FranciscoD) <sanjay.ankur>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: rawhideCC: gui1ty, igor.raits, ksurma, mhroncok, neuro-sig, sanjay.ankur
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: python-nibabel-5.2.1-2.fc41 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2024-04-02 17:18:22 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: 2244836    

Description Karolina Surma 2024-02-28 12:42:44 UTC
python-nibabel fails to build with Python 3.13.0a4.

=================================== FAILURES ===================================
_____________________ TestNibabelDeprecator.test_dep_func ______________________

self = <nibabel.tests.test_deprecated.TestNibabelDeprecator object at 0x7ff50f2b64b0>

    def test_dep_func(self):
        # Test function deprecation
        dec = self.dep_func
        func = dec('foo')(func_no_doc)
        with pytest.deprecated_call():
            assert func() is None
        assert func.__doc__ == 'foo\n'
        func = dec('foo')(func_doc)
        with pytest.deprecated_call() as w:
            assert func(1) is None
            assert len(w) == 1
        assert func.__doc__ == 'A docstring\n\nfoo\n'
        func = dec('foo')(func_doc_long)
        with pytest.deprecated_call() as w:
            assert func(1, 2) is None
            assert len(w) == 1
>       assert (
            func.__doc__
            == f'A docstring\n   \n   foo\n   \n{indent(TESTSETUP, "   ", lambda x: True)}'
            f'   Some text\n{indent(TESTCLEANUP, "   ", lambda x: True)}'
        )
E       AssertionError: assert 'A docstring\...ne, None)\n\n' == 'A docstring\... None)\n   \n'
E           A docstring
E         -    
E         -    foo
E         -    
E         -    
E         -    
E         + ...
E         
E         ...Full output truncated (43 lines hidden), use '-vv' to show

nibabel/tests/test_deprecator.py:95: AssertionError
_______________________ TestDeprecatorFunc.test_dep_func _______________________

self = <nibabel.tests.test_deprecator.TestDeprecatorFunc object at 0x7ff50f229f40>

    def test_dep_func(self):
        # Test function deprecation
        dec = self.dep_func
        func = dec('foo')(func_no_doc)
        with pytest.deprecated_call():
            assert func() is None
        assert func.__doc__ == 'foo\n'
        func = dec('foo')(func_doc)
        with pytest.deprecated_call() as w:
            assert func(1) is None
            assert len(w) == 1
        assert func.__doc__ == 'A docstring\n\nfoo\n'
        func = dec('foo')(func_doc_long)
        with pytest.deprecated_call() as w:
            assert func(1, 2) is None
            assert len(w) == 1
>       assert (
            func.__doc__
            == f'A docstring\n   \n   foo\n   \n{indent(TESTSETUP, "   ", lambda x: True)}'
            f'   Some text\n{indent(TESTCLEANUP, "   ", lambda x: True)}'
        )
E       AssertionError: assert 'A docstring\...ne, None)\n\n' == 'A docstring\... None)\n   \n'
E           A docstring
E         -    
E         -    foo
E         -    
E         -    
E         -    
E         + ...
E         
E         ...Full output truncated (43 lines hidden), use '-vv' to show


According to https://docs.python.org/3.13/whatsnew/3.13.html:
docstring indentation is now stripped by compiler.

For the build logs, see:
https://copr-be.cloud.fedoraproject.org/results/@python/python3.13/fedora-rawhide-x86_64/07068013-python-nibabel/

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

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 Sandro 2024-03-28 13:25:41 UTC
Reported upstream.

Comment 2 Fedora Update System 2024-04-02 17:14:30 UTC
FEDORA-2024-e31b4cfbdd (python-nibabel-5.2.1-2.fc41) has been submitted as an update to Fedora 41.
https://bodhi.fedoraproject.org/updates/FEDORA-2024-e31b4cfbdd

Comment 3 Fedora Update System 2024-04-02 17:18:22 UTC
FEDORA-2024-e31b4cfbdd (python-nibabel-5.2.1-2.fc41) has been pushed to the Fedora 41 stable repository.
If problem still persists, please make note of it in this bug report.