fix cellmagic and load_ext is shorter

This commit is contained in:
Maarten A. Breddels 2021-01-06 19:07:16 +01:00
parent 78ffee2936
commit 27ebe7646c
3 changed files with 8 additions and 4 deletions

View File

@ -214,7 +214,7 @@ We see that NumPy has trouble returning to Python land because the main thread h
First, load the magics
```
%load_ext per4m.cellmagic
%load_ext per4m
```
Run a cell with the `%%giltracer` cell magic.

View File

@ -4,4 +4,8 @@ try:
__version__ = get_distribution("per4m").version
except DistributionNotFound:
# package is not installed
pass
pass
def load_ipython_extension(ipython):
from .cellmagic import load_ipython_extension
load_ipython_extension(ipython)

View File

@ -32,11 +32,11 @@ class GilTraceMagic(Magics):
builder.save(output_file=out_path)
download = HTML(f'''<a href="{out_path}" download>Download {out_path}</a>''')
view = HTML(f'''<a href="{out_path}" target="_blank" rel=”noopener noreferrer”>Open {out_path} in new tab</a> (might not work due to security issue)''')
view = HTML(f'''<a href="{out_path}" target="_blank" rel="noopener noreferrer">Open {out_path} in new tab</a> (might not work due to security issue)''')
display(download, view)
def load_ipython_extension(ipython):
"""
Use `%load_ext per4m.cellmagic`
"""
ipython.register_magics(GilTraceMagic)
ipython.register_magics(GilTraceMagic)