versioning schemes in package imports (was Re: [Import-sig] imputil)

Michel Sanner sanner@scripps.edu
Thu, 15 Mar 2001 10:21:40 -0800


Sorry MAL,

I really meant to send this to import-sig@python.org

Thanks you all for these useful information

On Mar 15,  6:35pm, M.-A. Lemburg wrote:
> Subject: Re: versioning schemes in package imports (was Re: [Import-sig] i
> Peter Funk wrote:
> >
> > Hi,
> >
> > sorry for jumping in on this thread that late.
> >
> > > Michel Sanner wrote:
> > > > I am trying to come up with a way to handle versions of packages
> > [...]
> > > > package structure:
> > > > A/
> > > >         A_1_0/
> > > >         A_1_1/
> > > >         A_1_2/
> > [...]
> > > > >>> A.importer.set_version("1_0")
> > > > >>> from A import B # should import A.A_1_0.B
> > [...]
> >
> > Gordon McMillan answered:
> > > Actually, in this case you don't really *need* imputil.
> > [...]
> >
> > What I want to add is: The package Pmw (Python Mega Widgets,
> > see <http://Pmw.sourceforge.net/>.) written by Greg McFarlane
> > <mailto:gregm@iname.com> contains a versioning mechanism comparable
> > to what Michel Saner seems to want.
> >
> > BTW: Pmw is a Python extension very useful for everybody interested
> > in programming X-platform portable GUIs.
> >

We are using Pmw and I looked at its importer. What I did not like is that each
package would have to implement its own importer. I have an application Pmv
that uses about 7 other packages. I could not see how to re-implement the
PmwLoader to make it a generic loader that all these packages could use.

The other problem I noticed was that I cannot say:
>>> from Pmw import EntryField

I have wuite a bit of code that is alreday written using such imports and using
an approach preventing the "from package import something" syntax would mean
major modifications :(

I will look at your "riped-out version" may be you did exactly what I wanted to
do but did not know how to ! (could you point me towards one of these packages
?)

>
> You may want to have a look at mx.Misc.LazyModule in the
> egenix-mx-base package. It is used by most mx subpackages
> to enable submodule/-package load without additional import.
>
I will look at the mx.Misc.LazyModule


On a more general note, I use Python because it allows me to develop re-usable
components and I do re-sue other people's components. This is a major strength
of Python in my opinion. If every package has its own way to deal with versions
it makes it complicated and less elegant to check for version and set versions.
It would be great if versioning was an integral part of packages and would be
handled the same way by everyone. maybe like in Tcl where you can

require pacakage foo 1.5

Thanks again for the hints. I will drop imputil and investigated the different
alternative you have suggested.

-Michel

--

-----------------------------------------------------------------------

>>>>>>>>>> AREA CODE CHANGE <<<<<<<<< we are now 858 !!!!!!!

Michel F. Sanner Ph.D.                   The Scripps Research Institute
Assistant Professor			Department of Molecular Biology
					  10550 North Torrey Pines Road
Tel. (858) 784-2341				     La Jolla, CA 92037
Fax. (858) 784-2860
sanner@scripps.edu                        http://www.scripps.edu/sanner
-----------------------------------------------------------------------



---End of forwarded mail from <sanner@noah.scripps.edu> ("Michel Sanner")

-- 

-----------------------------------------------------------------------

>>>>>>>>>> AREA CODE CHANGE <<<<<<<<< we are now 858 !!!!!!!

Michel F. Sanner Ph.D.                   The Scripps Research Institute
Assistant Professor			Department of Molecular Biology
					  10550 North Torrey Pines Road
Tel. (858) 784-2341				     La Jolla, CA 92037
Fax. (858) 784-2860
sanner@scripps.edu                        http://www.scripps.edu/sanner
-----------------------------------------------------------------------