ewels / rich-click

Format click help output nicely with rich.
https://ewels.github.io/rich-click/
MIT License
630 stars 36 forks source link

Continuting to receive "DeprecationWarning: OptionHighlighter is deprecated" as of 1.8.1 #197

Closed jamescooke closed 6 months ago

jamescooke commented 6 months ago

This relates to the original issue regarding warnings in https://github.com/ewels/rich-click/issues/194

Current behaviour

As of version 1.8.1 the warning is still received.

Here's a what's received when running Pytest on a test on a click app:

=========================================== warnings summary ============================================
tests/test_script_import_statement.py::test
  /home/james/active/ltools/venv312/lib/python3.12/site-packages/rich_click/rich_click.py:132: DeprecationWarning: OptionHighlighter is deprecated and will be removed in a future version.
    from rich_click.rich_help_configuration import OptionHighlighter

tests/test_script_import_statement.py::test
  <string>:85: DeprecationWarning: `highlighter` kwarg is deprecated in RichHelpConfiguration. Please do one of the following instead: either set highlighter_patterns=[...] if you want to use regex; or for more advanced use cases where you'd like to use a different type of rich.highlighter.Highlighter, subclass the `RichHelpFormatter` and update its `highlighter`.

Error appears to come from line 132 which was changed here: https://github.com/ewels/rich-click/pull/196/files#diff-738a2a418c0833585666208ca8a8c9e73b3cd275586e21094d7be7f0fc51dd8fR132

(Running with 1.8.0, the warning bubbles from rich_click/rich_click.py:121, which has changed to line 132 as above)

Expected behaviour

No warning is received externally for an internal rich-click warning as mentioned in #194 .

(Personal side note - there is absolutely no rush from me to get this fixed. Just wanted to flag that the warning issue is still present in 1.8.1 🙏🏻 )

dwreeves commented 6 months ago

Ah, let me look into this when I get a second. I didn't realize there were two warnings being triggered, but that makes sense that there are. Apologies! As stated in the other issue, our test suite right now is going through a makeover between 1.8 and 1.9.

dwreeves commented 6 months ago

I think this should be done. Closing this.

jamescooke commented 5 months ago

After installing main with pip, there's still a warning coming from line 132 of rich_click.py:

tests/test_script_pickle_statement.py::test_current
  /home/james/active/ltools/venv312/lib/python3.12/site-packages/rich_click/rich_click.py:132: DeprecationWarning: OptionHighlighter is deprecated and will be removed in a future version.
    from rich_click.rich_help_configuration import OptionHighlighter

That's from these lines I think: https://github.com/ewels/rich-click/blob/2c6e49014475172c5984f956382d435d0df962bd/src/rich_click/rich_help_configuration.py#L243-L247

dwreeves commented 5 months ago

@jamescooke Sorry. Commented that out for 1.8.3, which was just released. Thanks for your patience and thank you for using rich-click! ❤️