[IPython-dev] Request: IPython.ext namespace
MinRK
benjaminrk at gmail.com
Thu Oct 25 15:49:03 EDT 2012
All modules can already be extensions or contain extensions. Any
importable module that has a `load_ipython_extension(ip)` function is a
valid extension.
An excellent example of this is sympyprinting, which was recently moved out
of IPython<https://github.com/ipython/ipython/blob/master/IPython/extensions/sympyprinting.py>and
into
sympy<https://github.com/sympy/sympy/blob/master/sympy/interactive/ipythonprinting.py>.
It is now loaded as:
%load_ext sympy.interactive.ipythonprinting
This is just a regular Python module that is a part of sympy. There is
nothing extra to install.
So I would say that this is already a solved problem, and there is no
reason to deal with a special namespace.
-MinRK
On Thu, Oct 25, 2012 at 12:28 PM, Takafumi Arakaki <aka.tkf at gmail.com>wrote:
> Hi,
>
> I think IPython should provide namespace for IPython extensions, so
> that extension authors can upload their extensions to PyPI. I don't
> care about what the actual name is (probably it can be ipythonext,
> IPythonContrib, IPython.extensions, or what ever). It is something
> what Sphinx does for "sphinxcontrib.*" namespace. I can think of many
> reasons why it is better for IPython extension users and authors:
>
> 1. When you want to use external Python module in your extension,
> currently there is no easy way to install it. If you can upload
> your extension as `IPython.ext.YOUREXT`, it can be easily solved.
>
> 2. Similarity, you can depends on other IPython extensions. Currently
> there is no easy way to import other IPython extensions.
>
> 3. It does not stop people using `%install_ext`. If your extension is
> just one file, you can just do::
>
> %install_ext
>
> https://raw.github.com/YOU/ipython-ext-YOUREXT/master/IPython/ext/YOUREXT.py
>
> 4. You get IPython extension search engine for free. People can just do::
>
> pip search IPython.ext
>
> Try ``pip search sphinxcontrib``, for example.
>
> 5. It helps people avoiding namespace collision. Currently there is
> no easy way to make sure if other people not using some name.
> Sure, you can google it, but you can't be 100% sure.
>
> 6. IPython don't need to create any machinery for this. All you need
> to do is to put some notice in the documentation for extension
> author.
>
>
> To be fair, I will try to think the reasons why you should not do this:
>
> 1. It may drive lazy people away from writing it. "Oh, I need setup.py
> for IPython extension? No... I won't upload it hen."
>
> (But you don't need to upload your extension to pypi, if your
> extension is just one file.)
>
> 2. It increases the amount and complexity of documentation you need to
> maintain. You need to explain: "You can install extensions using
> `pip` (or `easy_install`, if you want). Oh, you can use
> `%install_ext` magic by the way. But it cannot be used for some
> packages blah blah blah...".
>
>
> BTW, should I post something like this in ML or github issue? As
> there was old discussion in this ML [1]_, I am posting it here.
>
> .. [1]
> http://mail.scipy.org/pipermail/ipython-dev/2012-June/thread.html#9427
>
>
> --
> Takafumi Arakaki
> https://github.com/tkf
> _______________________________________________
> IPython-dev mailing list
> IPython-dev at scipy.org
> http://mail.scipy.org/mailman/listinfo/ipython-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/ipython-dev/attachments/20121025/f33d7770/attachment.html>
More information about the IPython-dev
mailing list