Bug 2265487 - python-beartype fails to build with Python 3.13: AssertionError: assert {'AsyncContex...'is_protocol'} == set(); indentation docstring mistmatch
Summary: python-beartype fails to build with Python 3.13: AssertionError: assert {'Asy...
Keywords:
Status: NEW
Alias: None
Product: Fedora
Classification: Fedora
Component: python-beartype
Version: rawhide
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Paul Wouters
QA Contact:
URL:
Whiteboard:
Depends On:
Blocks: PYTHON3.13
TreeView+ depends on / blocked
 
Reported: 2024-02-22 10:27 UTC by Karolina Surma
Modified: 2024-02-22 10:27 UTC (History)
3 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed:
Type: Bug
Embargoed:


Attachments (Terms of Use)

Description Karolina Surma 2024-02-22 10:27:36 UTC
python-beartype fails to build with Python 3.13.0a4.

=================================== FAILURES ===================================
_______________________________ test_api_typing ________________________________

    def test_api_typing() -> None:
        <snip>
    
        # Set of the basenames of all public attributes declared by the "typing"
        # module whose values are identical to those declared by the
        # "beartype.typing" submodule.
        TYPING_ATTR_EQUAL_NAMES = (
            BEARTYPE_TYPING_ATTR_NAME_TO_VALUE.keys() - TYPING_ATTR_UNEQUAL_NAMES)
    
        # ..................{ ASSERTS                            }..................
        #!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
        # CAUTION: When this assertion fails, the culprit is *USUALLY* the "typing"
        # module for the active Python module, which has probably erroneously
        # publicized one or more public attributes. In this case, the names of these
        # attributes *MUST* be manually added to the
        # "OFFICIAL_TYPING_ATTR_PUBLIC_BAD_NAMES" set defined far above.
        #!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
        # Assert that these two modules expose the same number of public attributes.
        # Since a simple assertion statement would produce non-human-readable
        # output, we expand this assertion to identify all differing attributes.
>       assert DIFFERENT_TYPING_ATTR_NAMES == set()
E       AssertionError: assert {'AsyncContex...'is_protocol'} == set()
E         Extra items in the left set:
E         'is_protocol'
E         'AsyncContextManager'
E         'get_protocol_members'
E         Full diff:
E         - set()
E         + {'AsyncContextManager', 'is_protocol', 'get_protocol_members'}

BEARTYPE_TYPING_ATTR_NAMES = dict_keys(['AbstractSet', 'Annotated', 'Any', 'AnyStr', 'AsyncContextManager', 'AsyncGenerator', 'AsyncIterable', 'Asy...is_typeddict', 'no_type_check', 'no_type_check_decorator', 'overload', 'override', 'reveal_type', 'runtime_checkable'])
BEARTYPE_TYPING_ATTR_NAME_TO_VALUE = {'AbstractSet': <class 'collections.abc.Set'>, 'Annotated': typing.Annotated, 'Any': typing.Any, 'AnyStr': ~AnyStr, ...}
DIFFERENT_TYPING_ATTR_NAMES = {'AsyncContextManager', 'get_protocol_members', 'is_protocol'}
IS_PYTHON_AT_LEAST_3_9 = True
OFFICIAL_TYPING_ATTR_NAMES = dict_keys(['AbstractSet', 'Annotated', 'Any', 'AnyStr', 'AsyncGenerator', 'AsyncIterable', 'AsyncIterator', 'Awaitable...is_typeddict', 'no_type_check', 'no_type_check_decorator', 'overload', 'override', 'reveal_type', 'runtime_checkable'])
OFFICIAL_TYPING_ATTR_NAME_TO_VALUE = {'AbstractSet': typing.AbstractSet, 'Annotated': typing.Annotated, 'Any': typing.Any, 'AnyStr': ~AnyStr, ...}
OFFICIAL_TYPING_ATTR_PUBLIC_BAD_NAMES = frozenset({'ABCMeta', 'CT_co', 'CallableMeta', 'EXCLUDED_ATTRIBUTES', 'GenericAlias', 'GenericMeta', ...})
TYPING_ATTR_EQUAL_NAMES = {'Annotated', 'Any', 'AnyStr', 'BinaryIO', 'ClassVar', 'Concatenate', ...}
TYPING_ATTR_UNEQUAL_NAMES = {'AbstractSet', 'AsyncContextManager', 'AsyncGenerator', 'AsyncIterable', 'AsyncIterator', 'Awaitable', ...}
beartype_typing = <module 'beartype.typing' from '/builddir/build/BUILD/beartype-0.17.2/beartype/typing/__init__.py'>
official_typing = <module 'typing' from '/usr/lib64/python3.13/typing.py'>

beartype_test/a00_unit/a00_core/test_a90_typing.py:223: AssertionError
_______________________ test_wrappee_descriptor_builtin ________________________

    def test_wrappee_descriptor_builtin() -> None:
        <snip>
    
        # ....................{ LOCALS                         }....................
        # Instance of this class.
        the_race = OrDidASeaOfFire()
    
        # ....................{ PASS                           }....................
        # Assert this class method accessed on both this instance and this class
        # returns the expected value.
        assert (
            OrDidASeaOfFire.envelop_once_this_silent_snow() ==
            the_race.envelop_once_this_silent_snow() ==
            'None can reply—all seems eternal now.'
        )
    
        # Assert this class method docstring has been preserved as is.
        assert OrDidASeaOfFire.envelop_once_this_silent_snow.__doc__ is not None
>       assert OrDidASeaOfFire.envelop_once_this_silent_snow.__doc__.startswith('''
                Arbitrary class method''')
E       AssertionError: assert False
E        +  where False = <built-in method startswith of str object at 0x7fc8f3cbe3f0>('\n            Arbitrary class method')
E        +    where <built-in method startswith of str object at 0x7fc8f3cbe3f0> = '\nArbitrary class method decorated first by the builtin\n:class:`classmethod` descriptor and then by the\n:func:`beartype.beartype` decorator, exercising an edge case in the\n:func:`beartype.beartype` decorator.\n\nNote that reversing this order of decoration does *not* exercising\nan edge case in the :func:`beartype.beartype` decorator and is thus\nomitted from testing.\n'.startswith
E        +      where '\nArbitrary class method decorated first by the builtin\n:class:`classmethod` descriptor and then by the\n:func:`beartype.beartype` decorator, exercising an edge case in the\n:func:`beartype.beartype` decorator.\n\nNote that reversing this order of decoration does *not* exercising\nan edge case in the :func:`beartype.beartype` decorator and is thus\nomitted from testing.\n' = <bound method test_wrappee_descriptor_builtin.<locals>.OrDidASeaOfFire.envelop_once_this_silent_snow of <class 'beartype_test.a00_unit.a70_decor.test_decorwrappee.test_wrappee_descriptor_builtin.<locals>.OrDidASeaOfFire'>>.__doc__
E        +        where <bound method test_wrappee_descriptor_builtin.<locals>.OrDidASeaOfFire.envelop_once_this_silent_snow of <class 'beartype_test.a00_unit.a70_decor.test_decorwrappee.test_wrappee_descriptor_builtin.<locals>.OrDidASeaOfFire'>> = <class 'beartype_test.a00_unit.a70_decor.test_decorwrappee.test_wrappee_descriptor_builtin.<locals>.OrDidASeaOfFire'>.envelop_once_this_silent_snow

beartype_test/a00_unit/a70_decor/test_decorwrappee.py:230: AssertionError

FAILED beartype_test/a00_unit/a00_core/test_a90_typing.py::test_api_typing - ...
FAILED beartype_test/a00_unit/a70_decor/test_decorwrappee.py::test_wrappee_descriptor_builtin
================== 2 failed, 316 passed, 10 skipped in 8.28s ===================

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

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

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

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.


Note You need to log in before you can comment on or make changes to this bug.