question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

How do we feel about adopting rich?

See original GitHub issue

What’s the problem this feature will solve?

We’re currently using the logging module for handling our output needs. This… works, but is suboptimal since we don’t really have any clean way to utilise all the flexibility that a terminal affords us; most notably colors and varying text presentations.

Describe the solution you’d like

Well, part of why I haven’t pursued https://github.com/pypa/pip/issues/6541 is that there’s no real benefit to doing that without something genuinely beneficial from a UI/UX perspective with that flexibility on the other side.

There weren’t any straightforward-and-major presentation gains to be made, by undertaking such a revamp. This is part of why I’ve let this loiter for so long. With rich though, we would have the required flexibility to actually make meaningful aesthetic improvements available with significantly lower effort (mostly because the required effort was already put into the library).

Alternative Solutions

Maintaining status quo is an option. So, is exploring alternatives to rich that might be more appropriate for our usecase.

I’m wary of directly using something low level though (eg: using colorama directly) since we’d either need to deal with the quirks of the terminal or reimplement many of the features that we’d get with a more rounded-out library like rich.

Additional context

We need to be mindful of our our distribution sizes.

-rw-r--r--  1 pradyunsg  staff   2.6M  3 Sep 10:44 pip-21.3.dev0+rich.tar.gz
-rw-r--r--  1 pradyunsg  staff   1.5M  3 Sep 10:44 pip-21.3.dev0.tar.gz

Most of this ocmes from pygments – we’ll likely need to do something to trim the styles and lexers (~4 MB uncompressed) which we can trim with our vendoring setup. IIUC we don’t need any of the web-related styling and only need the lexers related to Markdown and Python.

We’d also need buy-in from the maintainers (/cc @willmcgugan) of rich, since this imposes a couple of restrictions on the library – it can’t adopt non-pure Python dependencies without a graceful fallback and that we’re mindful of the sizes of the entire dependency tree.

I had a chat with him a few weeks ago where we talked about this, and he seemed hesitantly excited about the idea. 😃

Code of Conduct

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:13 (11 by maintainers)

github_iconTop GitHub Comments

3reactions
willmcgugancommented, Sep 3, 2021

Author of Rich here. Just to say that if you do decide to go down this route, I would be happy to help.

2reactions
pfmoorecommented, Sep 3, 2021

Ah, OK. Nevertheless, if we’re going to do this, we should remove any direct use we make of colorama in favour of going through rich’s abstractions for everything IMO.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Do you think children who are adopted into extreme wealth ...
I am adopted. I can tell you from my own experience that there are issues you deal with internally. I was adopted at...
Read more >
Should You Seek Out Wealthy Adoptive Parents? [What to ...
Contact us online or call us at 1-800-ADOPTION now if you feel adoption is right for you. If you're concerned about finding wealthy...
Read more >
Do You Have to Be Rich to Adopt?
No. You absolutely do not have to be rich to adopt. If you consider adoption through foster care, it can be very inexpensive,...
Read more >
Rich People Raise Rich Kids—Even When They're Adopted
Perhaps they grow up to be rich because they genetically inherit certain skills and preferences, such as a tendency to tuck away money...
Read more >
If you choose to adopt these 5 mindsets, you'll probably be ...
The truth is, rich people acquire assets — things that make them money over time — while poor people usually get liabilities, junk...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found