[Python-Dev] PEP 250, site-python, site-packages

Gregor Hoffleit gregor@hoffleit.de
Tue, 3 Jul 2001 14:09:51 +0200

PEP 250 talks about adopting site-packages for Windows systems. I'd like
to discuss the sitedirs as a whole.

Currently, site.py appends the following sitedirs to sys.path:

    * <prefix>/lib/python<version>/site-packages
    * <prefix>/lib/site-python

If exec-prefix is different from prefix, then also

    * <exec-prefix>/lib/python<version>/site-packages
    * <exec-prefix>/lib/site-python

>From the viewpoint of a Linux distribution, putting pure Python
extension packages in <prefix>/lib/python<version>/site-packages is
quite awkward: Debian has Python extension packages that would work
unmodified with all Python versions since 1.4 up to now; and still, for
every new <version> of Python, we have to make a new package, with only
the installation path changed.

Due to Python's good tradition of compatibility, this is the vast
majority of packages; only packages with binary modules necessarily need
to be recompiled anyway for each major new <version>.

What makes me wonder is that nobody seems to use site-python; Distutils
is completely unaware of it, and besides a few generic Debian packages
(reportbug, dpkg-python), no extension packages on my machine is in
site-python. site-packages OTOH is used by Distutils, and this PEP 250
would recommend its use even on Windows systems.

I would suggest to turn this upside down:

Python extensions should be installed in <prefix>/lib/site-python by
default. Only if they contain things that definitely should not be used
with any other Python <version> (e.g. binary modules), they might be
installed in the version-specific extension directory,

I'm thinking about modifying Debian's distutils in order to install all
architecture independent stuff in site-python. This would vastly ease
the maintenance of Python packages.