From thomas.heller@ion-tof.com  Fri Nov 17 16:21:50 2000
From: thomas.heller@ion-tof.com (Thomas Heller)
Date: Fri, 17 Nov 2000 17:21:50 +0100
Subject: [Import-sig] imputil
Message-ID: <038701c050b2$7dd00740$e000a8c0@thomasnotebook>

imputil, which is now an official part of
python, changes the semantics of sys.path
as soon as importers are installed.

On the other hand, a quick and dirty search
finds at least these files in the standard library
where it is assumed that sys.path is a list of strings:

linecache.py, profile.py, pdb.py, pyclbr.py

Should imputil be fixed to install the ImportManager
in a different way (not installing the importers
into sys.path), or should the library be fixed?

Thomas




From guido@python.org  Fri Nov 17 16:35:09 2000
From: guido@python.org (Guido van Rossum)
Date: Fri, 17 Nov 2000 11:35:09 -0500
Subject: [Import-sig] Re: [Python-Dev] imputil
In-Reply-To: Your message of "Fri, 17 Nov 2000 17:21:50 +0100."
 <038701c050b2$7dd00740$e000a8c0@thomasnotebook>
References: <038701c050b2$7dd00740$e000a8c0@thomasnotebook>
Message-ID: <200011171635.LAA26120@cj20424-a.reston1.va.home.com>

> imputil, which is now an official part of
> python, changes the semantics of sys.path
> as soon as importers are installed.
> 
> On the other hand, a quick and dirty search
> finds at least these files in the standard library
> where it is assumed that sys.path is a list of strings:
> 
> linecache.py, profile.py, pdb.py, pyclbr.py
> 
> Should imputil be fixed to install the ImportManager
> in a different way (not installing the importers
> into sys.path), or should the library be fixed?

Sorry to burst your bubble.  Imputil is still experimental.

--Guido van Rossum (home page: http://www.python.org/~guido/)


From thomas.heller@ion-tof.com  Fri Nov 17 16:45:15 2000
From: thomas.heller@ion-tof.com (Thomas Heller)
Date: Fri, 17 Nov 2000 17:45:15 +0100
Subject: [Import-sig] Re: [Python-Dev] imputil
References: <038701c050b2$7dd00740$e000a8c0@thomasnotebook>  <200011171635.LAA26120@cj20424-a.reston1.va.home.com>
Message-ID: <03f801c050b5$c34e38c0$e000a8c0@thomasnotebook>

> Sorry to burst your bubble.  Imputil is still experimental.
> 
That's what the import-sig should try to fix.

Thomas



From mal@lemburg.com  Fri Nov 17 16:45:58 2000
From: mal@lemburg.com (M.-A. Lemburg)
Date: Fri, 17 Nov 2000 17:45:58 +0100
Subject: [Import-sig] Re: [Python-Dev] imputil
References: <038701c050b2$7dd00740$e000a8c0@thomasnotebook>
Message-ID: <3A1560C6.B872D948@lemburg.com>

Thomas Heller wrote:
> 
> imputil, which is now an official part of
> python, changes the semantics of sys.path
> as soon as importers are installed.
> 
> On the other hand, a quick and dirty search
> finds at least these files in the standard library
> where it is assumed that sys.path is a list of strings:
> 
> linecache.py, profile.py, pdb.py, pyclbr.py
> 
> Should imputil be fixed to install the ImportManager
> in a different way (not installing the importers
> into sys.path), or should the library be fixed?

My understanding was that Importers need to provide
a __str__ method which is then used... haven't looked
at imputil.py in ages though, so I can't really comment.

Perhaps imputil.py should leave sys.path alone (or maybe just
wipe it from unneeded entries) and use a new sys.importers
object for the import management ?!

-- 
Marc-Andre Lemburg
______________________________________________________________________
Company:                                        http://www.egenix.com/
Consulting:                                    http://www.lemburg.com/
Python Pages:                           http://www.lemburg.com/python/


From thomas.heller@ion-tof.com  Fri Nov 17 17:24:17 2000
From: thomas.heller@ion-tof.com (Thomas Heller)
Date: Fri, 17 Nov 2000 18:24:17 +0100
Subject: [Import-sig] Re: [Python-Dev] imputil
References: <038701c050b2$7dd00740$e000a8c0@thomasnotebook> <3A1560C6.B872D948@lemburg.com>
Message-ID: <04a501c050bb$372df8c0$e000a8c0@thomasnotebook>

> Thomas Heller wrote:
> > 
> > imputil, which is now an official part of
> > python, changes the semantics of sys.path
> > as soon as importers are installed.
> > 
> > On the other hand, a quick and dirty search
> > finds at least these files in the standard library
> > where it is assumed that sys.path is a list of strings:
> > 
> > linecache.py, profile.py, pdb.py, pyclbr.py
> > 
> > Should imputil be fixed to install the ImportManager
> > in a different way (not installing the importers
> > into sys.path), or should the library be fixed?
[MAL]
> 
> My understanding was that Importers need to provide
> a __str__ method which is then used... haven't looked
> at imputil.py in ages though, so I can't really comment.
> 
No importer currently does define __str__, neither is it used
in the standard libary. The pattern is (in linecache):

        for dirname in sys.path:
            fullname = os.path.join(dirname, basename)

> Perhaps imputil.py should leave sys.path alone (or maybe just
> wipe it from unneeded entries) and use a new sys.importers
> object for the import management ?!
This sounds better.

Thomas




From gstein@lyra.org  Fri Nov 17 20:52:56 2000
From: gstein@lyra.org (Greg Stein)
Date: Fri, 17 Nov 2000 12:52:56 -0800
Subject: [Import-sig] imputil
In-Reply-To: <3A1560C6.B872D948@lemburg.com>; from mal@lemburg.com on Fri, Nov 17, 2000 at 05:45:58PM +0100
References: <038701c050b2$7dd00740$e000a8c0@thomasnotebook> <3A1560C6.B872D948@lemburg.com>
Message-ID: <20001117125256.O21426@lyra.org>

[ restricting to the import-sig ]

On Fri, Nov 17, 2000 at 05:45:58PM +0100, M.-A. Lemburg wrote:
> Thomas Heller wrote:
> > imputil, which is now an official part of
> > python, changes the semantics of sys.path
> > as soon as importers are installed.
> > 
> > On the other hand, a quick and dirty search
> > finds at least these files in the standard library
> > where it is assumed that sys.path is a list of strings:
> > 
> > linecache.py, profile.py, pdb.py, pyclbr.py
> > 
> > Should imputil be fixed to install the ImportManager
> > in a different way (not installing the importers
> > into sys.path), or should the library be fixed?
> 
> My understanding was that Importers need to provide
> a __str__ method which is then used... haven't looked
> at imputil.py in ages though, so I can't really comment.
> 
> Perhaps imputil.py should leave sys.path alone (or maybe just
> wipe it from unneeded entries) and use a new sys.importers
> object for the import management ?!

Guido didn't like that approach (which I had suggested at one point). He
wanted all the stuff to appear in sys.path, and for other code to "just
deal".

Cheers,
-g

-- 
Greg Stein, http://www.lyra.org/


From mal@lemburg.com  Sat Nov 18 12:58:49 2000
From: mal@lemburg.com (M.-A. Lemburg)
Date: Sat, 18 Nov 2000 13:58:49 +0100
Subject: [Import-sig] imputil
References: <038701c050b2$7dd00740$e000a8c0@thomasnotebook> <3A1560C6.B872D948@lemburg.com> <20001117125256.O21426@lyra.org>
Message-ID: <3A167D09.E81429F0@lemburg.com>

Greg Stein wrote:
> 
> [ restricting to the import-sig ]
> 
> On Fri, Nov 17, 2000 at 05:45:58PM +0100, M.-A. Lemburg wrote:
> > Thomas Heller wrote:
> > > imputil, which is now an official part of
> > > python, changes the semantics of sys.path
> > > as soon as importers are installed.
> > >
> > > On the other hand, a quick and dirty search
> > > finds at least these files in the standard library
> > > where it is assumed that sys.path is a list of strings:
> > >
> > > linecache.py, profile.py, pdb.py, pyclbr.py
> > >
> > > Should imputil be fixed to install the ImportManager
> > > in a different way (not installing the importers
> > > into sys.path), or should the library be fixed?
> >
> > My understanding was that Importers need to provide
> > a __str__ method which is then used... haven't looked
> > at imputil.py in ages though, so I can't really comment.
> >
> > Perhaps imputil.py should leave sys.path alone (or maybe just
> > wipe it from unneeded entries) and use a new sys.importers
> > object for the import management ?!
> 
> Guido didn't like that approach (which I had suggested at one point). He
> wanted all the stuff to appear in sys.path, and for other code to "just
> deal".

But sys.path is about OS level path names... perhaps we ought to
reconsider this ?!

After all, it would allow easy checking of whether there is
enhanced import management in place or not and sys.path could
even be reused in some way by these importers in some way.

AFAIR, there was no general agreement on how to redesign
the import mechanism. Maybe what we need is not a redesign,
but instead an extensible way to extend the import mechanism...
take for example the codec registry design: instead of
pushing some sort of package layout on the codec packages,
the packages can register a search function which then
implements whatever lookup is needed.

A similar approach could help adding new import mechanisms
to Python without ripping out the existing support.

-- 
Marc-Andre Lemburg
______________________________________________________________________
Company:                                        http://www.egenix.com/
Consulting:                                    http://www.lemburg.com/
Python Pages:                           http://www.lemburg.com/python/