mirror of
https://github.com/rdkit/rdkit.git
synced 2026-06-03 21:44:30 +08:00
Automatically load the ipython extensions running in Jupyter (#2626)
* Automatically load the ipython extensions if we are running in an jupyter notebook * Only activate inside the ZMQInteractiveShell
This commit is contained in:
committed by
Greg Landrum
parent
e7eca3a8a0
commit
269977f72c
@@ -3,3 +3,16 @@ try:
|
||||
except ImportError:
|
||||
__version__ = 'Unknown'
|
||||
raise
|
||||
|
||||
# if we are running in a jupyter notebook, enable the extensions
|
||||
try:
|
||||
kernel_name = get_ipython().__class__.__name__
|
||||
|
||||
if kernel_name == 'ZMQInteractiveShell':
|
||||
from rdkit.Chem.Draw import IPythonConsole
|
||||
from rdkit.Chem import LogWarningMsg, WrapLogs
|
||||
WrapLogs()
|
||||
LogWarningMsg("Enabling RDKit %s jupyter extensions"%__version__)
|
||||
|
||||
except:
|
||||
pass
|
||||
|
||||
Reference in New Issue
Block a user