Bug 2356179

Summary: monkeytype fails to build with Python 3.14: typing.Union changed with Python 3.14.0a6
Product: [Fedora] Fedora Reporter: Karolina Surma <ksurma>
Component: monkeytypeAssignee: Michel Lind <michel>
Status: NEW --- QA Contact:
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: rawhideCC: davide, fti-bugs, ksurma, mhroncok, michel
Target Milestone: ---Flags: fti-bugs: needinfo? (michel)
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: ---
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 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: 2322407, 2339432, 2339435    

Description Karolina Surma 2025-03-31 10:01:43 UTC
monkeytype fails to build with Python 3.14.0a6.

_______________ TestTypeConversion.test_type_round_trip[Union0] ________________
tests/test_encoding.py:82: in test_type_round_trip
    assert type_from_dict(type_to_dict(typ)) == typ
E   AssertionError: assert <class 'typing.Union'> == str | None
E    +  where <class 'typing.Union'> = type_from_dict({'module': 'typing', 'qualname': 'Union'})
E    +    where {'module': 'typing', 'qualname': 'Union'} = type_to_dict(str | None)
_______________ TestTypeConversion.test_type_round_trip[Union1] ________________
tests/test_encoding.py:82: in test_type_round_trip
    assert type_from_dict(type_to_dict(typ)) == typ
E   AssertionError: assert <class 'typing.Union'> == tests.util.Outer.Inner | str | None
E    +  where <class 'typing.Union'> = type_from_dict({'module': 'typing', 'qualname': 'Union'})
E    +    where {'module': 'typing', 'qualname': 'Union'} = type_to_dict(tests.util.Outer.Inner | str | None)
________________ TestTypeConversion.test_type_round_trip[Dict3] ________________
tests/test_encoding.py:82: in test_type_round_trip
    assert type_from_dict(type_to_dict(typ)) == typ
E   assert typing.Dict[str, typing.Union] == typing.Dict[str, str | int]
E     
E     Full diff:
E     - typing.Dict[str, str | int]
E     + typing.Dict[str, typing.Union]
________________ TestTypeConversion.test_type_round_trip[List2] ________________
tests/test_encoding.py:82: in test_type_round_trip
    assert type_from_dict(type_to_dict(typ)) == typ
E   assert typing.List[typing.Union] == typing.List[str | None]
E     
E     Full diff:
E     - typing.List[str | None]
E     + typing.List[typing.Union]
________________ TestTypeConversion.test_type_round_trip[Dict4] ________________
tests/test_encoding.py:82: in test_type_round_trip
    assert type_from_dict(type_to_dict(typ)) == typ
E   assert typing.Dict[str, typing.Union] == typing.Dict[s...Inner] | None]
E     
E     Full diff:
E     - typing.Dict[str, typing.Dict[str, int] | typing.Set[tests.util.Outer.Inner] | None]
E     + typing.Dict[str, typing.Union]
_______ TestRenderAnnotation.test_render_annotation[Union-Optional[int]] _______
tests/test_stubs.py:213: in test_render_annotation
    assert render_annotation(annotation) == expected
E   assert "<class 'Union'>[int, None]" == 'Optional[int]'
E     
E     - Optional[int]
E     + <class 'Union'>[int, None]
____ TestRenderAnnotation.test_render_annotation[List-List[Optional[int]]] _____
tests/test_stubs.py:213: in test_render_annotation
    assert render_annotation(annotation) == expected
E   assert "List[<class ...>[int, None]]" == 'List[Optional[int]]'
E     
E     - List[Optional[int]]
E     + List[<class 'Union'>[int, None]]
_____________ TestFunctionStub.test_optional_parameter_annotation ______________
tests/test_stubs.py:279: in test_optional_parameter_annotation
    assert stub.render() == expected
E   AssertionError: assert 'def test(x: ... -> None: ...' == 'def test(x: ... -> None: ...'
E     
E     - def test(x: Optional[int] = ...) -> None: ...
E     ?             ^^^   ^^
E     + def test(x: <class 'Union'>[int, None] = ...) -> None: ...
E     ?             ^^^^^^^^^^   ^^    ++++++
__________ TestFunctionStub.test_optional_union_parameter_annotation ___________
tests/test_stubs.py:285: in test_optional_union_parameter_annotation
    assert stub.render() == expected
E   AssertionError: assert 'def test(x: ... -> None: ...' == 'def test(x: ... -> None: ...'
E     
E     - def test(x: Optional[Union[int, float]]) -> None: ...
E     ?             ^^^^^^ ^^                ^
E     + def test(x: <class 'Union'>[int, float, None]) -> None: ...
E     ?             ^^^ ^^^^     ++           ^^^^^^
_______________ TestFunctionStub.test_optional_return_annotation _______________
tests/test_stubs.py:291: in test_optional_return_annotation
    assert stub.render() == expected
E   AssertionError: assert 'def test() -...t, None]: ...' == 'def test() -...nal[int]: ...'
E     
E     - def test() -> Optional[int]: ...
E     + def test() -> <class 'Union'>[int, None]: ...
_________ TestFunctionStub.test_split_parameters_across_multiple_lines _________
tests/test_stubs.py:303: in test_split_parameters_across_multiple_lines
    assert stub.render() == expected
E   AssertionError: assert 'def has_leng...t, None]: ...' == 'def has_leng...l[float]: ...'
E     
E       def has_length_exceeds_120_chars(
E           very_long_name_parameter_1: float,
E           very_long_name_parameter_2: float
E     - ) -> Optional[float]: ...
E     + ) -> <class 'Union'>[float, None]: ...
___________ TestFunctionStub.test_default_none_parameter_annotation ____________
tests/test_stubs.py:315: in test_default_none_parameter_annotation
    assert stub.render() == expected
E   AssertionError: assert 'def test(x: ... -> None: ...' == 'def test(x: ... -> None: ...'
E     
E     - def test(x: Optional[int] = ...) -> None: ...
E     ?             ^^^   ^^
E     + def test(x: <class 'Union'>[int, None] = ...) -> None: ...
E     ?             ^^^^^^^^^^   ^^    ++++++
_________________ TestFunctionStub.test_forward_ref_annotation _________________
tests/test_stubs.py:335: in test_forward_ref_annotation
    assert stub.render() == expected
E   assert "def has_forw...', None]: ..." == "def has_forw...onStub']: ..."
E     
E     - def has_forward_ref() -> Optional['TestFunctionStub']: ...
E     ?                          ^^^   ^^
E     + def has_forward_ref() -> <class 'Union'>['TestFunctionStub', None]: ...
E     ?                          ^^^^^^^^^^   ^^                   ++++++
__________________________ TestClassStub.test_render ___________________________
tests/test_stubs.py:369: in test_render
    assert class_stub.render() == expected
E   AssertionError: assert 'class Test:\...e, None]: ...' == 'class Test:\...l[frame]: ...'
E     
E       class Test:
E           bar: str
E           foo: int
E           @classmethod
E     -     def a_class_method(cls, foo: Any) -> Optional[frame]: ...
E     ?                                          ^^^   ^^...
E     
E     ...Full output truncated (6 lines hidden), use '-vv' to show
__________________________ TestModuleStub.test_render __________________________
tests/test_stubs.py:608: in test_render
    assert mod_stub.render() == expected
E   AssertionError: assert 'class DummyA...e, None]: ...' == 'class DummyA...l[frame]: ...'
E     
E       class DummyAnInstanceMethodTypedDict__RENAME_ME__(TypedDict):
E           c: int
E       
E       
E       class FooTypedDict__RENAME_ME__(TypedDict):
E           a: int...
E     
E     ...Full output truncated (46 lines hidden), use '-vv' to show
_________________ TestBuildModuleStubs.test_build_module_stubs _________________
tests/test_stubs.py:807: in test_build_module_stubs
    assert build_module_stubs(entries) == expected
E   AssertionError: assert {'tests.test_...Any'}})), ())} == {'tests.test_...onal'}}), ())}
E     
E     Omitting 1 identical items, use -vv to show
E     Differing items:
E     {'tests.util': ModuleStub((), (ClassStub('Dummy', (FunctionStub('a_static_method', <Signature (foo: Any) -> frame | No...tionKind.INSTANCE: 2>, ['typing'], False)), ()),), ImportBlockStub(ImportMap(<class 'set'>, {'typing': {'Any'}})), ())} != {'tests.util': ModuleStub((), (ClassStub('Dummy', (FunctionStub('a_class_method', <Signature (cls, foo: Any) -> frame ...e | None>, <FunctionKind.STATIC: 3>, ['typing'], False)), ()),), ImportBlockStub({'typing': {'Any', 'Optional'}}), ())}
E     
E     Full diff:
E       {...
E     
E     ...Full output truncated (4 lines hidden), use '-vv' to show
_____ TestGetImportsForAnnotation.test_special_case_types[Union-expected1] _____
tests/test_stubs.py:1233: in test_special_case_types
    assert get_imports_for_annotation(anno) == expected
E   AssertionError: assert ImportMap(<class 'set'>, {}) == {'typing': {'Union'}}
E     
E     Right contains 1 more item:
E     {'typing': {'Union'}}
E     
E     Full diff:
E     + ImportMap(<class 'set'>, {})
E     - {...
E     
E     ...Full output truncated (4 lines hidden), use '-vv' to show
______ TestGetImportsForAnnotation.test_container_types[Union-expected5] _______
tests/test_stubs.py:1254: in test_container_types
    assert get_imports_for_annotation(anno) == expected
E   AssertionError: assert ImportMap(<class 'set'>, {}) == {'tests.util'...g': {'Union'}}
E     
E     Right contains 2 more items:
E     {'tests.util': {'Dummy'}, 'typing': {'Union'}}
E     
E     Full diff:
E     + ImportMap(<class 'set'>, {})
E     - {...
E     
E     ...Full output truncated (7 lines hidden), use '-vv' to show


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

For the build logs, see:
https://copr-be.cloud.fedoraproject.org/results/@python/python3.14/fedora-rawhide-x86_64/08837246-monkeytype/

For all our attempts to build monkeytype with Python 3.14, see:
https://copr.fedorainfracloud.org/coprs/g/python/python3.14/package/monkeytype/

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

Let us know here if you have any questions.

Python 3.14 is planned to be included in Fedora 43.
To make that update smoother, we're building Fedora packages with all pre-releases of Python 3.14.
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 Karolina Surma 2025-06-11 15:54:18 UTC
*** Bug 2371746 has been marked as a duplicate of this bug. ***

Comment 2 Fedora Fails To Install 2025-06-20 19:52:09 UTC
Hello,

Please note that this comment was generated automatically by https://pagure.io/releng/blob/main/f/scripts/ftbfs-fti/follow-policy.py
If you feel that this output has mistakes, please open an issue at https://pagure.io/releng/

This package fails to install and maintainers are advised to take one of the following actions:

 - Fix this bug and close this bugzilla once the update makes it to the repository.
   (The same script that posted this comment will eventually close this bugzilla
   when the fixed package reaches the repository, so you don't have to worry about it.)

or

 - Move this bug to ASSIGNED if you plan on fixing this, but simply haven't done so yet.

or

 - Orphan the package if you no longer plan to maintain it.


If you do not take one of these actions, the process at https://docs.fedoraproject.org/en-US/fesco/Fails_to_build_from_source_Fails_to_install/#_package_removal_for_long_standing_ftbfs_and_fti_bugs will continue.
This package may be orphaned in 7+ weeks.
This is the first reminder (step 3) from the policy.

Don't hesitate to ask for help on https://lists.fedoraproject.org/archives/list/devel@lists.fedoraproject.org/ if you are unsure how to fix this bug.