-
Notifications
You must be signed in to change notification settings - Fork 903
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
The road to introducing rich
into Kedro natively
#1464
Comments
Thanks for writing up this issue so clearly @datajoely! I really like the look of I remember when you did the demo for point 2 and changed the default handler in |
@MerelTheisenQB I can't see any downside of us making the rich handler the default independently of whatever we do with logging.yml |
I meant to say is it still possible to make |
Oh I see what you mean - I guess this is an implementation detail. I was imagining that all library classes are pre-configured to log nicely in the console. The main ones for me are the Today we set the config here in the session: kedro/kedro/framework/session/session.py Line 193 in c42ae6d
I was imagining that we would still have a default console logging configuration that could be overridden if they user wanted to, we could even default to the logging template within Kedro already. |
I think Merel is asking this because earlier today we have this coming task is to make |
So I guess I'm okay with binning the default |
Words cannot express how much I love everything about this. Really amazing work on the plugin and beautiful write-up here! 🚀 😮 One small question: I see that in some places you hard code colours like On the logging.yml point: your suggestion is definitely compatible with the changes we're making. Basically we're removing the project-side logging.yml (though users can still create it if they like) but keeping the framework-side one. So we would just change the framework-side console handler to use |
So @AntonyMilneQB I have some very good news for you :)
|
Most of this has now been implemented. The remaining ones are new issues in https://github.com/kedro-org/kedro/milestone/15. |
Description
rich is an amazing library that superpowers the terminal experience. It is now mature, stable and Lightweight (212.2 kB, with minimal dependencies).
As a Kedro user one spends most of their time interacting with
I'm a strong believer that the developer experience in these two areas can be greatly improved by adopting rich natievely.
In my own time I've been working on a
kedro-rich
plugin, I hope to release this once #1309 is merged but it would also make sense to introduce many of these ideas natively over time with developer experience in mind.The response to this prototype has been positive on both discord and twitter so I'm pretty confident there is sufficient user evidence for us to pursue this.
Checkpoints
1. Closing related issues and PRs:
after_command_run
CLI hook spec #1309 therunner_name
key will unblock the release of my plug-in as it will be easy to disable the hooks in Parallel mode.2. We should migrate the default console logging format using the
rich.logging.RichHandler
3. We should improve the standard log lines so they pretty print during a run:
kedro/kedro/io/data_catalog.py
Line 339 in c42ae6d
kedro/kedro/io/data_catalog.py
Line 377 in c42ae6d
kedro/kedro/pipeline/node.py
Line 327 in c42ae6d
4. We should adopt the rich exception handler
It's a one line change, improves the UX/DX and has a really neat mechanism for suppressing framework frames.
The example here suppresses
click
, we could do this as well as suppressingkedro
itself. It still shows the frame if the exception is within those libraries, but allows the user to skip to important part of the call stack.5. Improving the CLI experience for users outside of a project directory:
One of the most common traps for newbies is the way that Kedro behaves inside of a project directory versus outside of one.
This is because Kedro makes a distinction between 'Global' and 'Project' command groups depending on whether it finds itself in a Kedro directory (i.e. we can detect the correct
pyrpoject.toml
metadata)Whilst not really rich specific, I've used rich markup to make my patch for this print nicely:
This is way better than the current experience which gives the quite confusing, albeit semantically correct error "
No such command 'run'
".6. We should introduce progress bars to the runner experience:
rich.logging.RichHandler
allows us to introduce a complimentary set ofrich.progress.Progress
bars which will render nicely.ParallelRunner
. Multiprocessing is weird since it's hard to share memory.ParallelRunner
sub-branch 🚀7. We could leverage the 3rd party rich-click package:
import rich_click as click
The text was updated successfully, but these errors were encountered: