DIPlib / diplib

Quantitative Image Analysis in C++, MATLAB and Python
https://diplib.org
Apache License 2.0
222 stars 49 forks source link

Don't import IPython if it's not already imported. #127

Closed anntzer closed 1 year ago

anntzer commented 1 year ago

The IPython integration only makes sense in an actual IPython shell, which implies that IPython has already been imported previously (i.e., is in sys.modules).

Previously, IPython would always be imported as long as it is installed, but that can be quite slow (adding ~0.4s of overhead for me) which is significant in short-running scripts (that may e.g. be repeatedly spawned from bash).

crisluengo commented 1 year ago

This is a lot faster. Thank you!