[IPython-dev] Request: IPython.ext namespace
Bradley M. Froehle
brad.froehle at gmail.com
Thu Oct 25 18:03:08 EDT 2012
In Python 3.3 and later this namespace issue will be resolved by
PEP-420: Implicit Namespace Packages
(http://www.python.org/dev/peps/pep-0420/).
On Thu, Oct 25, 2012 at 2:04 PM, Takafumi Arakaki <aka.tkf at gmail.com> wrote:
> On Thu, Oct 25, 2012 at 9:41 PM, Jake Vanderplas
> <vanderplas at astro.washington.edu> wrote:
>> Hi,
>> There's one particularly difficult issue with disparate packages sharing
>> a namespace: multiple install paths cause problems. For example, if you
>> have a system-wide ipython installation and then install a new extension
>> in a local folder, you can get an import error because the extension
>> does not exist in the first version of the namespace found by python.
>> This was one of the main problems that led to deprecation of the scikits
>> namespace.
>> Jake
>
> I see. That's the fundamental problem. Shared namespace definitely
> not good idea then!
>
> I'd like to have some rule such as ipyext_ prefix though. But as
> packages may have IPython extension as submodule like sympy does it
> won't be constant anyway.
>
>
>>
>> On 10/25/2012 12:28 PM, Takafumi Arakaki 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
>>
>>
>> _______________________________________________
>> IPython-dev mailing list
>> IPython-dev at scipy.org
>> http://mail.scipy.org/mailman/listinfo/ipython-dev
> _______________________________________________
> IPython-dev mailing list
> IPython-dev at scipy.org
> http://mail.scipy.org/mailman/listinfo/ipython-dev
More information about the IPython-dev
mailing list