Repository: python-pillow/Pillow

Issue:
Confusion getting PIL / Pillow version string
I was trying to figure out which version of pillow (PIL) is installed, and stumbled on this:

```cmd
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:
- https://github.com/python-pillow/Pillow/blob/master/src/PIL/version.py
- https://github.com/python-pillow/Pillow/blob/master/src/PIL/__init__.py#L2


Discussion:
@gnbl A fork, _by definition_, is confusing. We're open to considering any _specific changes_ you suggest to make Pillow versioning less confusing (preferably in the form of a pull request!) As far as I know, it's possible we could drop the 1.1.7 at some point. At least, I can't think of any specific reason why we couldn't do that…

Resolving patch:
diff --git a/setup.py b/setup.py
--- a/setup.py
+++ b/setup.py
@@ -122,7 +122,7 @@ def _read(file):
 
 
 def get_version():
-    version_file = 'src/PIL/version.py'
+    version_file = 'src/PIL/_version.py'
     with open(version_file, 'r') as f:
         exec(compile(f.read(), version_file, 'exec'))
     return locals()['__version__']
diff --git a/src/PIL/__init__.py b/src/PIL/__init__.py
--- a/src/PIL/__init__.py
+++ b/src/PIL/__init__.py
@@ -11,12 +11,12 @@
 
 # ;-)
 
-from . import version
+from . import _version
 
 VERSION = '1.1.7'  # PIL Version
-PILLOW_VERSION = version.__version__
+PILLOW_VERSION = __version__ = _version.__version__
 
-__version__ = PILLOW_VERSION
+del _version
 
 _plugins = ['BlpImagePlugin',
             'BmpImagePlugin',
diff --git a/src/PIL/version.py b/src/PIL/_version.py
similarity index 50%
rename from src/PIL/version.py
rename to src/PIL/_version.py
--- a/src/PIL/version.py
+++ b/src/PIL/_version.py
@@ -1,2 +1,2 @@
 # Master version for Pillow
-__version__ = '5.1.0'
+__version__ = '5.2.0.dev0'


Test patch: