Skip to content

Confusion getting PIL / Pillow version string #3082

@gnbl

Description

@gnbl

I was trying to figure out which version of pillow (PIL) is installed, and stumbled on this:

Python 3.6.5 (v3.6.5:f59c0932b4, Mar 28 2018, 17:00:18) [MSC v.1900 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import PIL
>>> PIL.version
<module 'PIL.version' from 'C:\\Users\\me\\AppData\\Local\\Programs\\Python\\Python36\\lib\\site-packages\\PIL\\version.py'>
>>> help(PIL.version)
Help on module PIL.version in PIL:

NAME
    PIL.version - # Master version for Pillow

VERSION
    5.1.0

FILE
    c:\users\me\appdata\local\programs\python\python36\lib\site-packages\pil\version.py


>>> help(PIL)
Help on package PIL:

NAME
    PIL

DESCRIPTION
    # The Python Imaging Library.
    # $Id$
    #
    # package placeholder
    #
    # Copyright (c) 1999 by Secret Labs AB.
    #
    # See the README file for information on usage and redistribution.
    #

PACKAGE CONTENTS
    BdfFontFile
    BlpImagePlugin
    ...

>>> PIL.VERSION
'1.1.7'
>>> PIL.version.__version__
'5.1.0'
>>> PIL.PILLOW_VERSION
'5.1.0'
>>> PIL.__version__
'5.1.0'
>>>
  • it's confusing that PIL.VERSION returns the version string of the former PIL instead of Pillow's
  • there does not seem to be documentation on this version number (why this, will it ever change, ..) e.g. at https://pillow.readthedocs.io/en/5.1.x/about.html#why-a-fork
  • it's confusing that PIL.version is a module and does not return the version information directly or hints on how to get it
  • the package information header is essentially useless (placeholder, does not even mention Pillow, nor the version)
  • PIL.version module documentation comment could explain how to access the version information

Others also have trouble finding it: https://stackoverflow.com/questions/44739775/how-to-get-python-pil-version

Source files:

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions