caltechlibrary / iga

IGA is the InvenioRDM GitHub Archiver, a standalone program as well as a GitHub Action that lets you automatically archive GitHub software releases in an InvenioRDM repository.
https://caltechlibrary.github.io/iga/
Other
8 stars 1 forks source link

OptionHighlighter Error in rich_click #40

Open tmorrell opened 3 months ago

tmorrell commented 3 months ago

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 https://github.com/ewels/rich-click/commit/0ab5aea34481fa0941404ceb1226291da3254391

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 commented 2 months ago

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 commented 2 months ago

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.