[Python-Dev] Another approach for the import mechanism

Gustavo Niemeyer niemeyer@conectiva.com
Thu, 5 Dec 2002 21:21:27 -0200


> > - Allows one to have zip packages inside other packages.
> 
> you can achieve this with __path__

Indeed. Thanks for mentioning that.

> > - Avoids including zip files in the path.
> 
> I want to support that.

Well... :-)

> > - Allows me to ship a package inside a zip file, without asking
> >   the user to change his path.
> >
> > - Allows me to compress a single file (foobar.py.bz2).
> 
> Java has support for zipfiles from day one, from my user experience
> they are both YAGNI.

If I want to provide packaged RPMs for small systems, I'd like
that *every* module/package which can be installed optionally, be
packaged inside a compressed file. There are real usage for
that right now.

> sys.path content from my point of view is really a deployment time
> issue.

I'm not sure about what you mean here.

> The 2nd point is not directly addressed by your proposal, and supporting it
> would make for more complicated importer impls.

Yes, it is addressed. My propose is to allow the importer mechanism to
check if there's something importable with the given name in the given
path, instead of telling him what to import. With that in mind,
importing foobar.py.bz2 is just a matter of checking for
<modulename>.py.bz2 in the given path.

-- 
Gustavo Niemeyer

[ 2AAC 7928 0FBF 0299 5EB5  60E2 2253 B29A 6664 3A0C ]