org-arl / arlpy

ARL Python Tools
BSD 3-Clause "New" or "Revised" License
118 stars 37 forks source link

Updating detection logic for ipython #92

Closed notthetup closed 9 months ago

notthetup commented 9 months ago

If arlpy is imported by a script run using %run in Jupyter, then the _sys.argv[0] doesn't seem to contain ipykernel_launcher anymore, but contains the name of the script being run.

Looking for ZMQInteractiveShell in get_ipython().__class__.__name__ seems to be a much more reliable way to figure out if we're inside a Jupyter session