Random musings on a way to organize your modules.

Jack Jansen (jack@cwi.nl)
Thu, 31 Mar 1994 21:21:30 GMT

One thing that has been nagging me for a long time is how we are going
to keep different versions of modules apart, especially when python
becomes popular and oodles of people will be putting out incompatible
versions of all sorts of modules. This has been triggered again by two
threads on the mailing list the last week: the one about the
incompatible versions of 'dbm' and the other about the two
python-interfaces to SUIT.

I foresee that in a short while I'll grab a wonderful module off the
net only to find out that it doesn't work because it imports another
module of which I have a different, incompatible, version. (Actually,
I think that *I* am reasonably safe, being across the hall from Guido,
*you* all will be in trouble:-). (Coming to think of it, it has already
threatened to happen, I was going to post my audio-biff here, but it
needs a newer version of rfc822.py than the one in the distribution).
(Hmm, I shouldn't use so many parenthesized sentences).

Even though that problem will still be fairly easy to fix, by getting
the new version of the module off someone, the sh*t will really hit
the fan some time later when I import two modules that import
incompatible versions of a third module. The problem is exacerbated in
python because of the interpretive nature of the language: things may
look bright when you first test the program and the module
incompatabilities may take weeks before showing up...

I've had a couple of discussions with Guido about this, but we haven't
really come up with anything. Actually, Guido doesn't seem to be as
concerned as I am, so maybe it is just my eternal pessimistic view on
life that bothers me:-).

Guido wrote a module 'addpack' the other day that solves part of the
problem (the call addpack('foo') will search your sys.path for a
subdirectory named 'foo' and add that directory to sys.path, so it
will at least solve naming clashes if you organise your modules in a
sensible way, unless the clash occurs within a single program). I feel
that more is needed, for instance a scheme whereby you can at least
check that the module you import is the module you expect to import
(or a compatible one). I have no idea about how to set out designing
such a scheme, though...

Does anyone have any ideas on how to solve this problem? Maybe there's
other language-communities that have solved this already...

-- 
--
Jack Jansen        | If I can't dance I don't want to be part of
Jack.Jansen@cwi.nl | your revolution             -- Emma Goldman
uunet!cwi.nl!jack    G=Jack;S=Jansen;O=cwi;PRMD=surf;ADMD=400net;C=nl