Bug 2246132 - python-grabbit fails to build with Python 3.13: AttributeError: module 'logging' has no attribute 'warn'
Summary: python-grabbit fails to build with Python 3.13: AttributeError: module 'loggi...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Fedora
Classification: Fedora
Component: python-grabbit
Version: rawhide
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Sandro
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks: PYTHON3.13
TreeView+ depends on / blocked
 
Reported: 2023-10-25 14:27 UTC by Karolina Surma
Modified: 2024-04-07 16:21 UTC (History)
6 users (show)

Fixed In Version: python-grabbit-0.2.6-29.fc41
Clone Of:
Environment:
Last Closed: 2024-04-07 16:21:27 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Github grabbles grabbit pull 95 0 None open Replace deprecated function logging.warn() 2024-03-27 21:29:54 UTC

Description Karolina Surma 2023-10-25 14:27:02 UTC
python-grabbit fails to build with Python 3.13.0a1.

=================================== FAILURES ===================================
_______________________ TestWritableFile.test_build_file _______________________

self = <grabbit.tests.test_writable.TestWritableFile object at 0x7fa0a2c4c6e0>
writable_file = <grabbit.core.File object at 0x7fa0a2970f50>
tmpdir = local('/tmp/pytest-of-mockbuild/pytest-0/test_build_file0')
caplog = <_pytest.logging.LogCaptureFixture object at 0x7fa0a283caa0>

    def test_build_file(self, writable_file, tmpdir, caplog):
        writable_file.tags = {'task': Tag(None, 'rest'), 'run': Tag(None, '2'),
                              'subject': Tag(None, '3')}
    
        # Simple write out
        new_dir = join(writable_file.dirname, 'rest')
        pat = join(writable_file.dirname,
                   '{task}/sub-{subject}/run-{run}.nii.gz')
        target = join(writable_file.dirname, 'rest/sub-3/run-2.nii.gz')
        writable_file.copy(pat)
        assert exists(target)
    
        # Conflict handling
        with pytest.raises(ValueError):
            writable_file.copy(pat)
        with pytest.raises(ValueError):
            writable_file.copy(pat, conflicts='fail')
>       writable_file.copy(pat, conflicts='skip')

grabbit/tests/test_writable.py:115: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
grabbit/core.py:139: in copy
    write_contents_to_file(new_filename, contents=contents,
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

path = '/tmp/pytest-of-mockbuild/pytest-0/test_build_file0/tmp/rest/sub-3/run-2.nii.gz'
contents = '###', link_to = None, content_mode = 'text', root = None
conflicts = 'skip'

    def write_contents_to_file(path, contents=None, link_to=None,
                               content_mode='text', root=None, conflicts='fail'):
        """
        Uses provided filename patterns to write contents to a new path, given
        a corresponding entity map.
    
        Args:
            path (str): Destination path of the desired contents.
            contents (str): Raw text or binary encoded string of contents to write
                to the new path.
            link_to (str): Optional path with which to create a symbolic link to.
                Used as an alternative to and takes priority over the contents
                argument.
            content_mode (str): Either 'text' or 'binary' to indicate the writing
                mode for the new file. Only relevant if contents is provided.
            root (str): Optional root directory that all patterns are relative
                to. Defaults to current working directory.
            conflicts (str): One of 'fail', 'skip', 'overwrite', or 'append'
                that defines the desired action when the output path already
                exists. 'fail' raises an exception; 'skip' does nothing;
                'overwrite' overwrites the existing file; 'append' adds  a suffix
                to each file copy, starting with 1. Default is 'fail'.
        """
    
        if root is None and not isabs(path):
            root = os.getcwd()
    
        if root:
            path = join(root, path)
    
        if exists(path) or islink(path):
            if conflicts == 'fail':
                msg = 'A file at path {} already exists.'
                raise ValueError(msg.format(path))
            elif conflicts == 'skip':
                msg = 'A file at path {} already exists, skipping writing file.'
>               logging.warn(msg.format(path))
E               AttributeError: module 'logging' has no attribute 'warn'

According to https://docs.python.org/3.13/whatsnew/3.13.html:

logging: Remove undocumented and untested Logger.warn() and LoggerAdapter.warn() methods and logging.warn() function.
Deprecated since Python 3.3, they were aliases to the logging.Logger.warning() method,
logging.LoggerAdapter.warning() method and logging.warning() function.
(Contributed by Victor Stinner in gh-105376.)


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

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

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 Ben Beasley 2024-01-05 16:32:04 UTC
This is surely fixable, but I’ve proposed orphaning and/or retiring this package instead: bug 2256958

Comment 2 Aoife Moloney 2024-02-15 23:01:54 UTC
This bug appears to have been reported against 'rawhide' during the Fedora Linux 40 development cycle.
Changing version to 40.

Comment 3 Sandro 2024-03-27 21:29:55 UTC
Patch sent upstream and applied downstream. Going to rebuild for rawhide.

Comment 4 Sandro 2024-03-27 21:51:08 UTC
(In reply to Ben Beasley from comment #1)
> This is surely fixable, but I’ve proposed orphaning and/or retiring this
> package instead: bug 2256958

Dang! I've overlooked your comment entirely. I suppose we can still opt for retirement, even though it has been fixed. I'll hold off on merging my PR for now.

Comment 5 Fedora Update System 2024-04-07 16:18:17 UTC
FEDORA-2024-8461ac141f (python-grabbit-0.2.6-29.fc41) has been submitted as an update to Fedora 41.
https://bodhi.fedoraproject.org/updates/FEDORA-2024-8461ac141f

Comment 6 Fedora Update System 2024-04-07 16:21:27 UTC
FEDORA-2024-8461ac141f (python-grabbit-0.2.6-29.fc41) has been pushed to the Fedora 41 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.