[IPython-dev] IPython.Extensions on sys.path

Walter Dörwald walter at livinglogic.de
Thu Nov 2 04:55:39 CST 2006


Ville M. Vainio wrote:

> On 11/2/06, Walter Dörwald <walter at livinglogic.de> wrote:
> 
>> IMHO the proper way to treat such dependencies would be to document the
>> dependency and let the user install the required module. With setuptools
>> this can be done automatically:
>>      setup(
>>          ...,
>>          install_requires=[
>>             "path.py >= 2.1",
>>          ],
>>      )
> 
> We are still in "no setuptools required" zone (and will for a while,
> probably - it didn't end up in python 2.5). And path.py isn't
> installable via easy_install at this moment.

Well, easy_install
http://www.jorendorff.com/articles/python/path/path-2.1.zip works, but I
agree that it would be better if path 2.1 was available from the cheeseshop.

> I'd like to see all these
> handy little modules bundled with IPython instead.

OK.

>> On Windows we already have a dependency on other packages (actually two:
>> pyreadline and ctypes) anyway.
> 
> ctypes is bundled with python 2.5, and pyreadline is easy_install-able.

Maybe we should convince Jason Orendorff to upload a new version to the
cheeseshop?

>> Would this mean that all modules that are just copies of third-party
>> module and can work independently from IPython should be imported via
>> "import foo" and modules that depend on IPython should be imported via
>> "from IPython.Extensions import foo"?
> 
> Yes. Though I'm not so sure about "from IPython.Extensions", it's up
> to the author of the code to determine which feels more comfortable.
> Technically, "Extensions" should all be IPython dependent (IPython
> extension plugins) but ATM it also contains stuff that is importable
> as top level modules when running inside IPython.
> 
>> I'm not sure. At least there would no longer be identical copies of the
>> same module. But installing IPython would then "overwrite" the original
>> version of the module, i.e. when importing it you'll get the IPython
>> version instead of the original one.
> 
> Yeah, I don't like that either.
> 
>> I'd like to use Philip Eby's simplegeneric module
>> (http://cheeseshop.python.org/pypi/simplegeneric) for ipipe. xrepr(),
>> xiter() and xattrs() could benefit from being generic functions. I
>> already experimented in this direction some time ago, but now that a
>> simple standalone generic function module is available it no longer
>> makes sense to reinvent the wheel.
>>
>> Philip's OK with us bundling the module, as long as it doesn't conflict
>> with any installed version of simplegeneric, which it would (but only
>> when running inside IPython).
> 
> Ok. Put it into IPython folder (not IPython/Extensions) and import it
> explicitly from there ("from IPython import simplegeneric").

OK, will do.

> I'm still -1 on removing Extensions from sys.path, though.

As long as we have a conflict free way of bundling third-party modules,
I can live with that.

Servus,
   Walter


More information about the IPython-dev mailing list