ewels/rich-click

Invalid MRO when importing rich_click

Closed this issue · 4 comments

I've been using rich_click for quite a while - currently at 1.7.4. After bumping to 1.8 I'm getting errors with the following code:

import rich_click as click

error:

..\..\..\..\robotidy\cli.py:6: in <module>
    import rich_click as click
..\..\..\..\venv312\Lib\site-packages\rich_click\__init__.py:74: in <module>
    from rich_click.decorators import command as command
..\..\..\..\venv312\Lib\site-packages\rich_click\decorators.py:9: in <module>
    from rich_click.rich_command import RichCommand, RichGroup, RichMultiCommand  # noqa: F401
..\..\..\..\venv312\Lib\site-packages\rich_click\rich_command.py:301: in <module>
    class RichGroup(Group, RichMultiCommand):
E   TypeError: Cannot create a consistent method resolution
E   order (MRO) for bases Group, RichMultiCommand

It looks like both Group and RichMultiCommand inherits from Command class which causes issues with MRO.

Thanks for submitting an issue!

Which version of Python are you using? And which version of Click? Is there anything else in your configuration that may be of interest?

This is a weird issue, as it's not something we ever ran into when testing. I have a suspicion of what may be causing it.

That's what I thought!

This is super helpful, I had a feeling the latest version of Click would cause issues, and I hadn't actually tested this part of the code. Thank you for unwittingly testing that for us 😅

I will have click~9 working (hopefully) as part of the 1.8.1 release. At least, this MRO issue will be resolved.

Github autoclosed this issue. I didn't fully test this (sorry, in a rush). I think it should be fixed. But let me know if it isn't.