-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Description
What's the problem this feature will solve?
Currently, pip directly uses logging to log the output on the command line. This means that core logic within pip contains messages that show up on the user. This has various effects, such as complication of code to create better error messages, mixing of "UI" and "business logic" etc.
Describe the solution you'd like
Separate the "core" and "ui" of pip, by using a few objects that act as a layer of abstraction between the two.
I wanted to make note of this idea, even though I'm not sure what this would look like yet or how complicated the implementation/transition would be.
I definitely think this has the potential to improve some bits within pip, especially since error message creation / wording can be better separated from the logic that handles things along with making it explicit at the interface of what the error messages should contain.
Alternative Solutions
Maintain status quo, of logging error messages directly and adding a helper function when the error-messaging logic becomes too complicated.
Additional context
https://www.destroyallsoftware.com/talks/boundaries is a good talk, that's sorta related but not a source/inspiration of this idea.
The closest equivalent to this that I can think of, is taking the idea of the deprecated
helper and applying it to pip's entire logging stack.