##// END OF EJS Templates
Inform in the docs about removal of define_magic.
Pavol Juhas -
Show More
@@ -115,19 +115,11 b' instantiate the class yourself before registration:'
115 ip.register_magics(magics)
115 ip.register_magics(magics)
116
116
117
117
118 In earlier versions, IPython had an API for the creation of line magics (cell
118 .. note::
119 magics did not exist at the time) that required you to create functions with a
119
120 method-looking signature and to manually pass both the function and the name.
120 In early IPython versions 0.12 and before the line magics were
121 While this API is no longer recommended, it remains indefinitely supported for
121 created using a :func:`define_magic` API function. This API has been
122 backwards compatibility purposes. With the old API, you'd create a magic as
122 replaced with the above in IPython 0.13 and then completely removed
123 follows:
123 in IPython 5. Maintainers of IPython extensions that still use the
124
124 :func:`define_magic` function are advised to adjust their code
125 .. sourcecode:: python
125 for the current API.
126
127 def func(self, line):
128 print("Line magic called with line:", line)
129 print("IPython object:", self.shell)
130
131 ip = get_ipython()
132 # Declare this function as the magic %mycommand
133 ip.define_magic('mycommand', func)
General Comments 0
You need to be logged in to leave comments. Login now