-
-
Notifications
You must be signed in to change notification settings - 8000 Fork 1.4k
magic tqdm #443
New issue
Have a question about this project? 8000 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
Comments
This is nice but has the additional |
We have to reimplement IsNotebook. It's pretty tiny. |
yes but my concern is there doesn't seem to be a consensus on how precisely to write an |
That one works very well, as intended. |
I've been using the following in my library, where I only want the progress bars if I'm running in an IPython environment:
Not sure how robust it is, though, but it correctly distinguishes between terminal |
Something like this could possibly work, which correctly returns import re
import psutil
def is_notebook():
return any(
re.search(r'\bjupyter-(lab|notebook)\b', x)
for x in psutil.Process().parent().cmdline()
) I'm not sure if it works for remote kernels, though |
maybe checking ipywidget instead of jupyter? |
Basically, we can detect:
the problem being that
I'd be in favour of: from tqdm.magic import tqdm which would:
|
🎉 |
where
isNotebook
is according to https://stackoverflow.com/questions/15411967/how-can-i-check-if-code-is-executed-in-the-ipython-notebook/39662359#39662359The text was updated successfully, but these errors were encountered: