[Python-Dev] Relative Package Imports

James C. Ahlstrom jim@interet.com
Tue, 14 Sep 1999 13:49:41 -0400

"M.-A. Lemburg" wrote:
> Doesn't look nice, but what other syntax would look better ? It will
> have to use identifiers and thus is restricted to [a-zA-Z0-9_]+.

Maybe "__up__" or "__up" following the convention that
double-under names are special?  Just a thought...

> But what about other installations or tools like mxCrypto
> which plug into existing packages (Andrew's crypto package) ? Today
> such plugins only work side-by-side, ie. you have to install one
> part which sits in the plugin slot and one part which gets installed
> somewhere in a top-level PYTHONPATH dir. The plugin slot part then
> imports the Real Thing from outside the host package (this is how
> mxCrypto integrates itself with AMK's lib).

I am not familiar with this.  Dosen't this work?:


> The solution I'm using (and Zope is too) is to wrap a
> complete Python installation into the product, all setup to
> do the right thing. It makes the archive a little heavier...
> which is actually not so bad from a marketing POV. Bizarre,
> but people seem to want all those megs.

For the record, I distribute a hacked main program which
sets its own sys.path.

I think your and zope's solution may break if another
Python program is installed, and such
program changes PYTHONPATH and/or the registry.  That
is why I never change PYTHONPATH nor the registry.

Jim Ahlstrom