Skip to content

A jupyter ipython magic to run a cell but also reprint on output the source code

License

Notifications You must be signed in to change notification settings

osscar-org/reprint-magic

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

reprint-magic

A module that registers and defines a jupyter ipython magic to run and reprint on output the code.

Usage

First, you need to load the extension. If you do not want to change your ipython configuration to load it by default, run the following command at the top of your notebook:

%% load_ext reprint_magic

Use the %%reprint cell magic as follows:

%%reprint
def double_number(number):
    return 2*number

This will both output the source code of the cell in the output, and run the code.

The code will have a thin border around it. If you don't like it, use instead %%reprint --no-box or, equivalently, %%reprint -n.

This is particularly useful when used in combination with the appmode.

Demo

To see a demo, look into the jupyter notebook demo/demo.ipynb or see it live using binder (click below).

About

A jupyter ipython magic to run a cell but also reprint on output the source code

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages