1

I have written some IPython magic functions for my students, and I would like to have them installed using easy_install. So far the only way I have found is to copy a python file to a profile directory, but easy_install complains about a SandboxViolation when I do that.

Is there a way to install magic functions via setuptools?

JasonMArcher
  • 14,195
  • 22
  • 56
  • 52
John Kitchin
  • 2,236
  • 1
  • 17
  • 25

1 Answers1

3

Any importable Python module can be an IPython extension - you install it in the normal location, and then add a load_ipython_extension function which registers your magic functions. See the documentation on writing extensions.

Then you run %load_ext foo.bar (where foo.bar is your module name) to load the extension. You can also set a config file to load it every time IPython is started, but I don't think there's any good way to automate setting this up when a module is installed.

Thomas K
  • 39,200
  • 7
  • 84
  • 86