PEP: import version

Skip Montanaro skip at pobox.com
Thu May 13 16:20:25 EDT 2004


    Chris> Basic Goals:

    Chris> * Multiple versions of wxPython being installed at the same time

Presumably in different directories, so setting PYTHONPATH, LD_LIBRARY_PATH,
etc will distiguish them for applications.

    Chris> * Two or more programs, each using a different version could run
    Chris>   at once. 

This doesn't require a change to the language.  This requires a proper
setting of PYTHONPATH and/or LD_LIBRARY_PATH, etc.

    Chris> * Easy for developers - for testing with multiple versions etc

That's fine, and precludes the use of something like a hardcoded

    import wxPython version '2.4'

as someone else suggested.  In fact, this just cries out for either a
WXPYTHON_VERSION environment variable which the wxPython framework could use
or for setting PYTHONPATH.

    Chris> * Easy for users - their apps detect the right version to run
    Chris>   with

Getting the right version of dependent packages is an installation issue.
This should be detectable from either configure script, Makefile or
distutils setup.py script.

    Chris> * Cross-Platform solution

Distribute your apps with .bat file front ends on Windows, shell scripts
on Unix.

    Chris> More detail:

    Chris> * The ability for the programmer to specify the version used in
    Chris>   the code, ideally only on (or before) the first import of
    Chris>   wxPython

I fail to understand why that's a problem that needs to be addressed in the
Python program.  This is information which is know before the program is
run.  It belongs in an environment variable or front-end shell/bat script.

    Chris> * The ability to specify the version wanted with an environment 
    Chris> variable, so that multiple versions could be easily tested

This is the correct way to do this.

    Chris> * The ability to specify multiple versions that all work, in a 
    Chris>   ordered list of some sort.

Your installation program should detect all installed versions and pick the
latest version which intersects with the set of multiple working versions.

    Chris> * The ability to specify a "minimal" version, and higher versions 
    Chris> could be used.

Again, this goes in your setup.py script (or configure, or Makefile, or
whatever).  It's an install-time decision.

    Chris> * The ability for "from wx.lib import Something" to work as well, 
    Chris>   respecting the version

Assuming your installation software worked correctly this should be a
no-brainer. ;-)

Skip




More information about the Python-list mailing list