-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[v1.0.51] added jupyter magic support (#51)
* added jupyter magic support %%notify * Add the %%notify Jupyter command * Add Jupyter magic command docs * updated readme Co-authored-by: Cizin <[email protected]> Co-authored-by: Snir Shechter <[email protected]>
- Loading branch information
1 parent
436122c
commit 2abb7c3
Showing
4 changed files
with
52 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
from IPython.core.magic import Magics, magics_class, line_cell_magic | ||
from mlnotify.mlnotify import plugin_manager | ||
|
||
# Jupyter line and cell magic | ||
@magics_class | ||
class MLNotifyMagic(Magics): | ||
@line_cell_magic | ||
def notify(self, line, cell=None): | ||
plugin_manager.run_before() | ||
self.shell.run_cell(line) | ||
if cell is not None: | ||
self.shell.run_cell(cell) | ||
plugin_manager.run_after() | ||
|
||
|
||
def register_jupyter_magic(): | ||
ipython = get_ipython() | ||
ipython.register_magics(MLNotifyMagic) | ||
|