John Kitchin
John Kitchin

Reputation: 2433

Installing IPython magic functions from a Python module

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?

Upvotes: 1

Views: 1288

Answers (1)

Thomas K
Thomas K

Reputation: 40370

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.

Upvotes: 3

Related Questions