wasabi icon indicating copy to clipboard operation
wasabi copied to clipboard

Print to stderr instead of stdout

Open kytta opened this issue 2 years ago • 3 comments
trafficstars

As of now, wasabi just calls print(), which by default prints to the stdout. In my opinion, this is wrong, as stdout (in the Unix ideology) should be used to output the result of the program (for eventual piping), while stderr should be used for warnings and errors.

I propose adding a "stream" parameter to Printer.__init__(), which by default should be set to sys.stderr. You can then use it inside the print() call.

If you're low on free time, I can implement this, too :)

kytta avatar Jan 17 '23 09:01 kytta

Yes I've been asking for this internally as well :)

I wouldn't rush off to do it, as it's more about deciding the specifics of how it should work.

honnibal avatar Jan 17 '23 10:01 honnibal

My feeling is that it's fine to make it more configurable, but for our current use of wasabi it makes sense for the default to stay stdout. In many cases, the warnings and errors from wasabi are the actual output. (Whether you could argue that some of the current warnings in CLI commands could be python warnings instead is a separate issue.)

adrianeboyd avatar Jan 18 '23 09:01 adrianeboyd

I don't mind stdout being default 👌🏻, but having a way to customize it would be nice.

kytta avatar Jan 18 '23 15:01 kytta