[Image-SIG] Pillow, the "friendly" PIL fork

Christopher Barker Chris.Barker at noaa.gov
Sun Aug 1 21:04:05 CEST 2010


Alex Clark wrote:
> OK, I'm trying to figure this out. As I understand it, the result of the
> incompatibility is that:
> 
>  import Image
> 
> Fails in Zope 2 if PIL is installed because Zope 2 (OFS) has it's own Image
> module.

For quite some time, PIL has been delivered as both a package and with a 
pth file, so you can use the old style:

import Image

or the newer:

from PIL import Image.

The PIL directory (package) has a lot of modules in it, so I really 
don't want them all importable at the top level. So I generally remove 
the .pth file, so that only the later works on my systems, with my code.


I'd be a bit happier if "import Image" raised a deprecation warning, but 
I'm not sure how you'd do that. (I actually did help do that for the 
GDAL package, but that was set up differently - they actually had all 
their stuff dumped directly into site-packages).

But it's not hard to have ZOPE remove the pth file if that's what you want.

And when it comes down to it, there is no way to remove all possible 
name clashes --every package has to have a top-level name -- if ZOPE 
used a package called "PIL", you'd still have a clash.

But python does allow the "import as" construction, so you can always 
patch your own systems by changing the name of a package.

My tiny nit about "standards":

Having a __version__ attribute is a very common convention, if not a 
standard -- it would be nice if PIL supported it -- and that's a trivial 
patch:


in Image.py, add:

__version__ = VERSION

in __init__.py

add:

from Image import __version__


Another comment:

If someone is doing a "friendly" fork -- it's really the least you can 
do to be very public about what the heck the "issues" are that you want 
to address that are not being addressed by the main version.

>> At least a packaging
>> fork means that someone's over there is producing something more than
>> invectives, but I'd still prefer a patch.

Is packaging the only "issues" this fork is for?


-Chris



-- 
Christopher Barker, Ph.D.
Oceanographer

Emergency Response Division
NOAA/NOS/OR&R            (206) 526-6959   voice
7600 Sand Point Way NE   (206) 526-6329   fax
Seattle, WA  98115       (206) 526-6317   main reception

Chris.Barker at noaa.gov


More information about the Image-SIG mailing list