Bug 2271397

Summary: python-rich fails to build with Python 3.13: AssertionError: assert 'test_max_depth_dataclass.<locals>.Foo(foo=test_max_depth_dataclass.<locals>.Bar(bar=test_max_depth_dataclass.<locals>.Foo(foo=[])))' == 'Foo(foo=Bar(bar=Foo(...)))'
Product: [Fedora] Fedora Reporter: Karolina Surma <ksurma>
Component: python-richAssignee: Parag Nemade <pnemade>
Status: CLOSED NEXTRELEASE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: rawhideCC: ksurma, mhroncok, pnemade
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: 2025-01-23 04:43: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-03-25 12:31:06 UTC
python-rich fails to build with Python 3.13.0a5.


=================================== FAILURES ===================================
____________________________ test_pretty_dataclass _____________________________

    def test_pretty_dataclass():
        dc = ExampleDataclass(1000, "Hello, World", 999, ["foo", "bar", "baz"])
        result = pretty_repr(dc, max_width=80)
        print(repr(result))
        assert (
            result
            == "ExampleDataclass(foo=1000, bar='Hello, World', baz=['foo', 'bar', 'baz'])"
        )
        result = pretty_repr(dc, max_width=16)
        print(repr(result))
>       assert (
            result
            == "ExampleDataclass(\n    foo=1000,\n    bar='Hello, World',\n    baz=[\n        'foo',\n        'bar',\n        'baz'\n    ]\n)"
        )
E       assert "ExampleDataclass(foo=1000, bar='Hello, World', baz=['foo', 'bar', 'baz'])" == "ExampleDataclass(\n    foo=1000,\n    bar='Hello, World',\n    baz=[\n        'foo',\n        'bar',\n        'baz'\n    ]\n)"
E         + ExampleDataclass(foo=1000, bar='Hello, World', baz=['foo', 'bar', 'baz'])
E         - ExampleDataclass(
E         -     foo=1000,
E         -     bar='Hello, World',
E         -     baz=[
E         -         'foo',
E         -         'bar',
E         -         'baz'
E         -     ]
E         - )

tests/test_pretty.py:184: AssertionError
----------------------------- Captured stdout call -----------------------------
"ExampleDataclass(foo=1000, bar='Hello, World', baz=['foo', 'bar', 'baz'])"
"ExampleDataclass(foo=1000, bar='Hello, World', baz=['foo', 'bar', 'baz'])"
________________________ test_reference_cycle_dataclass ________________________

    def test_reference_cycle_dataclass():
        @dataclass
        class Example:
            x: int
            y: Any
    
        test = Example(1, None)
        test.y = test
        res = pretty_repr(test)
>       assert res == "Example(x=1, y=...)"
E       AssertionError: assert 'test_reference_cycle_dataclass.<locals>.Example(x=1, y=...)' == 'Example(x=1, y=...)'
E         - Example(x=1, y=...)
E         + test_reference_cycle_dataclass.<locals>.Example(x=1, y=...)

tests/test_pretty.py:356: AssertionError
___________________________ test_max_depth_dataclass ___________________________

    def test_max_depth_dataclass():
        @dataclass
        class Foo:
            foo: object
    
        @dataclass
        class Bar:
            bar: object
    
>       assert (
            pretty_repr(Foo(foo=Bar(bar=Foo(foo=[]))), max_depth=2)
            == "Foo(foo=Bar(bar=Foo(...)))"
        )
E       AssertionError: assert 'test_max_depth_dataclass.<locals>.Foo(foo=test_max_depth_dataclass.<locals>.Bar(bar=test_max_depth_dataclass.<locals>.Foo(foo=[])))' == 'Foo(foo=Bar(bar=Foo(...)))'
E         - Foo(foo=Bar(bar=Foo(...)))
E         + test_max_depth_dataclass.<locals>.Foo(foo=test_max_depth_dataclass.<locals>.Bar(bar=test_max_depth_dataclass.<locals>.Foo(foo=[])))

tests/test_pretty.py:487: AssertionError
=============================== warnings summary ===============================
tests/test_syntax.py:6
  /builddir/build/BUILD/rich-13.7.1/tests/test_syntax.py:6: DeprecationWarning: pkg_resources is deprecated as an API. See https://setuptools.pypa.io/en/latest/pkg_resources.html
    import pkg_resources

-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
=========================== short test summary info ============================
FAILED tests/test_pretty.py::test_pretty_dataclass - assert "ExampleDataclass...
FAILED tests/test_pretty.py::test_reference_cycle_dataclass - AssertionError:...
FAILED tests/test_pretty.py::test_max_depth_dataclass - AssertionError: asser...
============= 3 failed, 799 passed, 24 skipped, 1 warning in 4.76s =============

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/07198541-python-rich/

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

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 Parag Nemade 2025-01-23 04:43:22 UTC
I think this can be closed as Fedora 41 is already released.