Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@homm
Copy link
Member

@homm homm commented Apr 9, 2018

Partially fixes #3082.

It is really confusing for people to find three different constants in PIL module: VERSION, PILLOW_VERSION, __version__ and version. While VERSION is here for historical reasons and does matter, version is module is not required to end user at all. My suggestion is to hide it from users by removing from namespace:

In [1]: from PIL import _version
ImportError: cannot import name _version  # Python 2 only

In [2]: import PIL

In [3]: PIL._version
AttributeError: 'module' object has no attribute '_version'

@hugovk
Copy link
Member

hugovk commented Apr 9, 2018

I get a slightly different result for the first import:

Python 3.6.4 (default, Mar  1 2018, 18:36:50)
[GCC 4.2.1 Compatible Apple LLVM 9.0.0 (clang-900.0.39.2)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> from PIL import _version

>>> _version.__version__
'5.2.0.dev0'

>>> import PIL

>>> PIL._version
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
AttributeError: module 'PIL' has no attribute '_version'

@homm
Copy link
Member Author

homm commented Apr 9, 2018

Hmm, looks like python 2 vs 3 difference. Anyway, from PIL import _version is the direct call for people who know what they are doing, while PIL.version could be suggested by the code completion.

@aclark4life
Copy link
Member

@wiredfool will be the one to convince here, probably. I definitely don't care … assuming we are moving from "really confusing" to "less or confusing" or even better "no confusion anymore".

@wiredfool
Copy link
Member

Whatever.

Don't break the single version in c & python, and don't break the world by removing the PIL 1.1.7 version until we do a major release.

@homm
Copy link
Member Author

homm commented Apr 11, 2018

Don't break the single version in c & python,

Check

don't break the world by removing the PIL 1.1.7 version until we do a major release

Check

@homm homm merged commit 096a81b into python-pillow:master Apr 11, 2018
@homm homm deleted the versions-cleanup branch April 11, 2018 12:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Confusion getting PIL / Pillow version string

4 participants