icecream icon indicating copy to clipboard operation
icecream copied to clipboard

Added env variable way to output to stdout and autocheck for Jupyter

Open gjvnq opened this issue 3 years ago • 3 comments

Basically, icecream will now automatically output to stdout if any of the following is true:

  1. The environment variable PYTHON_ICECREAM_USE_STDOUT evaluates to true.
  2. The code is running from inside Jupyter.

gjvnq avatar Dec 18 '21 12:12 gjvnq

thank you for this PR!

why use stdout over stderr inside jupyter?

gruns avatar Jan 09 '22 03:01 gruns

Because stderr shows in a different background color that makes it look like an error or warning.

On Sun, 9 Jan 2022 at 00:59, Ansgar Grunseid @.***> wrote:

thank you for this PR!

why use stdout over stderr inside jupyter?

— Reply to this email directly, view it on GitHub https://github.com/gruns/icecream/pull/112#issuecomment-1008224915, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAXIYHEPUI2GCEJXQGDLM43UVEB3PANCNFSM5KKS7M7Q . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

You are receiving this because you authored the thread.Message ID: @.***>

gjvnq avatar Jan 09 '22 04:01 gjvnq

Related discussion: https://github.com/gruns/icecream/issues/77#issuecomment-994217945

@gjvnq Why not use the isnotebook you put there? IPython is a lot more general than Jupyter notebooks.

Another way to detect Jupyter is described here: https://github.com/gruns/icecream/issues/100#issuecomment-896250411

Apparently disabling colorama in Jupyter would be good too.

On another note, PYTHON_ICECREAM_USE_STDOUT is very wordy for a library all about convenience. IC_STDOUT seems sufficiently unique.

alexmojaki avatar Jan 09 '22 10:01 alexmojaki