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

Consider using rich-click or typer #2210

Closed
antonymilne opened this issue Jan 16, 2023 · 6 comments
Closed

Consider using rich-click or typer #2210

antonymilne opened this issue Jan 16, 2023 · 6 comments
Labels
Issue: Feature Request New feature or improvement to existing feature

Comments

@antonymilne
Copy link
Contributor

antonymilne commented Jan 16, 2023

Alternative mentioned below: https://github.com/tiangolo/typer, which is based on click and uses rich if installed. Would be good to understand better what are the pros/cons of migrating and whether it would be worth the effort.


Originally written by @datajoely in #1464.

Warning. We need to consider whether this is actually a good change before implementing it. It would solve #1752 but should be discussed with @deepyaman and carefully tested to see if it's an improvement overall.

We could leverage the 3rd party rich-click package:

  • The rich-click package is a small but actively maintained library which has reached v1.3.x at the time of writing.
  • It is a drop-in replacement for click, all you have to do in theory is import rich_click as click
  • If you want to use it piecemeal you can just provide the classes as arguments to the command/group decorators like I do here.
  • The main benefit of this library is the fact we get much more readable help messages, like so:
    image
@antonymilne antonymilne added the Issue: Feature Request New feature or improvement to existing feature label Jan 16, 2023
@MatthiasRoels
Copy link

Why not use Typer instead? https://github.com/tiangolo/typer

@datajoely
Copy link
Contributor

Good push - I was thinking the same this week!

@datajoely
Copy link
Contributor

Here's how we'd migrate
https://typer.tiangolo.com/tutorial/using-click/

@antonymilne antonymilne changed the title Consider using rich-click Consider using rich-click or typer Jan 19, 2023
@antonymilne
Copy link
Contributor Author

@MatthiasRoels: interesting thinking. I don't know whether it would be worth the effort migrating (e.g. there's some slightly weird custom stuff in our KedroCLI class), whereas changing to rich_click seemed to be a very simple change. But I would like to understand better how feasible this would be, the advantages, etc. I've added it to the ticket.

@astrojuanlu
Copy link
Member

I think rather than pursuing Typer to solve #1752, we should make rich optional #2928 and keep Kedro as lean as possible (hence avoid adding yet another dependency).

@astrojuanlu
Copy link
Member

We're proceeding with #2928

@astrojuanlu astrojuanlu closed this as not planned Won't fix, can't repro, duplicate, stale Apr 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Issue: Feature Request New feature or improvement to existing feature
Projects
Archived in project
Development

No branches or pull requests

4 participants