From 27ebe7646c512cca67f5f4649c1d2b86328f1856 Mon Sep 17 00:00:00 2001 From: "Maarten A. Breddels" Date: Wed, 6 Jan 2021 19:07:16 +0100 Subject: [PATCH] fix cellmagic and load_ext is shorter --- README.md | 2 +- per4m/__init__.py | 6 +++++- per4m/cellmagic.py | 4 ++-- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index aab5a25..378ffe6 100644 --- a/README.md +++ b/README.md @@ -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. diff --git a/per4m/__init__.py b/per4m/__init__.py index c2586a7..3cb5ccf 100644 --- a/per4m/__init__.py +++ b/per4m/__init__.py @@ -4,4 +4,8 @@ try: __version__ = get_distribution("per4m").version except DistributionNotFound: # package is not installed - pass \ No newline at end of file + pass + +def load_ipython_extension(ipython): + from .cellmagic import load_ipython_extension + load_ipython_extension(ipython) diff --git a/per4m/cellmagic.py b/per4m/cellmagic.py index d04543e..438c28c 100644 --- a/per4m/cellmagic.py +++ b/per4m/cellmagic.py @@ -32,11 +32,11 @@ class GilTraceMagic(Magics): builder.save(output_file=out_path) download = HTML(f'''Download {out_path}''') - view = HTML(f'''Open {out_path} in new tab (might not work due to security issue)''') + view = HTML(f'''Open {out_path} in new tab (might not work due to security issue)''') display(download, view) def load_ipython_extension(ipython): """ Use `%load_ext per4m.cellmagic` """ - ipython.register_magics(GilTraceMagic) \ No newline at end of file + ipython.register_magics(GilTraceMagic)