Skip to content

Instantly share code, notes, and snippets.

@Carreau
Created September 20, 2017 19:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Carreau/7147c98fb3bf1fdd1636b5208e3ab80b to your computer and use it in GitHub Desktop.
Save Carreau/7147c98fb3bf1fdd1636b5208e3ab80b to your computer and use it in GitHub Desktop.
import magic.
from IPython.core.magic import Magics, magics_class, line_magic
@magics_class
class Waskom(Magics):
@line_magic
def michael(self, line):
self.shell.set_next_input('import seaborn as sns')
ip = get_ipython()
ip.register_magics(Waskom)
# in a package
# def load_ipython_extension(ipython):
# ipython.register_magics(Waskom)
# and %load_ext, or set extension in conf file.
@Carreau
Copy link
Author

Carreau commented Sep 20, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment