Show More
@@ -153,6 +153,14 b' Here is a full example of a magic package. You can distribute magics using' | |||||
153 | setuptools, distutils, or any other distribution tools like `flit |
|
153 | setuptools, distutils, or any other distribution tools like `flit | |
154 | <http://flit.readthedocs.io>`_ for pure Python packages. |
|
154 | <http://flit.readthedocs.io>`_ for pure Python packages. | |
155 |
|
155 | |||
|
156 | When distributing magics as part of a package, recommended best practice is to | |||
|
157 | execute the registration inside the `load_ipython_extension` as demonstrated in | |||
|
158 | the example below, instead of directly in the module (as in the initial example | |||
|
159 | with the ``@register_*`` decorators). This means a user will need to explicitly | |||
|
160 | choose to load your magic with ``%load_ext``. instead implicitly getting it when | |||
|
161 | importing the module. This is particularly relevant if loading your magic has | |||
|
162 | side effects, if it is slow to load, or if it might override another magic with | |||
|
163 | the same name. | |||
156 |
|
164 | |||
157 | .. sourcecode:: bash |
|
165 | .. sourcecode:: bash | |
158 |
|
166 |
General Comments 0
You need to be logged in to leave comments.
Login now