[IPython-dev] IPython.Extensions on sys.path
Ville M. Vainio
vivainio at gmail.com
Thu Nov 2 02:30:46 CST 2006
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:
> "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. I'd like to see all these
handy little modules bundled with IPython instead.
> 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.
> 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").
I'm still -1 on removing Extensions from sys.path, though.
Ville M. Vainio - vivainio.googlepages.com
blog=360.yahoo.com/villevainio - g[mail | talk]='vivainio'
More information about the IPython-dev