Fix astroquery.utils.system_tools.in_ipynb()#2289
Conversation
|
I don't know if it's safe to rely on an environmental variable for this sort of check... but clearly the "robust-looking" approach we took wasn't. I'm OK with trying this. |
Codecov Report
@@ Coverage Diff @@
## main #2289 +/- ##
==========================================
+ Coverage 62.75% 62.77% +0.02%
==========================================
Files 130 130
Lines 16835 16828 -7
==========================================
Hits 10564 10564
+ Misses 6271 6264 -7
Continue to review full report at Codecov.
|
|
I wonder if we need this as a separate function or could just use the suggested workaround directly in |
An alternative might be try:
return 'connection_file' in get_ipython().config['IPKernelApp']
except NameError:
return FalseBut I don't know if there's actually any difference in practice. |
bsipocz
left a comment
There was a problem hiding this comment.
I still feel this may be now an overshoot for a separate function, but in either case the fix is working and an improvement itself.
|
Thanks @eerovaher! |
The purpose of
astroquery.utils.system_tools.in_ipynb()is to recognize if it is being called from a.ipynbnotebook or not, but the current function seems to always returnFalse. The function in this pull request returnsFalseif it is called fromipython, butTrueif called fromjupyter notebookorjupyter lab, at least for the versions I'm using.