Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OptionHighlighter Error in rich_click #40

Open
tmorrell opened this issue Jul 9, 2024 · 2 comments
Open

OptionHighlighter Error in rich_click #40

tmorrell opened this issue Jul 9, 2024 · 2 comments

Comments

@tmorrell
Copy link
Member

tmorrell commented Jul 9, 2024

Description

With rich_click 1.8.2 I get the following error:

ImportError: cannot import name 'OptionHighlighter' from 'rich_click.rich_click' (/opt/homebrew/lib/python3.9/site-packages/rich_click/rich_click.py)

This appears to be depreciated ewels/rich-click@0ab5aea

How to reproduce the issue

Install iga from scratch and type iga -s https://127.0.0.1:5000 https://github.com/mhucka/taupe/releases/tag/v1.2.0

Immediate solution is to pin rich_click to under 1.7.4

@panta-123
Copy link

panta-123 commented Jul 10, 2024

I added following in local code for the time being to run:

from rich.highlighter import RegexHighlighter
class OptionHighlighter(RegexHighlighter):
            """Highlights our special options."""

            highlights = [
                r"(^|[^\w\-])(?P<switch>-([^\W0-9][\w\-]*\w|[^\W0-9]))",
                r"(^|[^\w\-])(?P<option>--([^\W0-9][\w\-]*\w|[^\W0-9]))",
                r"(?P<metavar><[^>]+>)",
            ]
highlighter = OptionHighlighter()

If it is something that would be a solution, I can make PR.

@tmorrell
Copy link
Member Author

If it fixes the import issue, a PR would be appreciated. This isn't part of the code that I've worked with much, so it will probably be at least a month until we're able to get it reviewed.

@panta-123 panta-123 mentioned this issue Jul 17, 2024
3 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants