PEP440 gives the example that ~= 1.4.5a4 should be equivalent to >= 1.4.5a4, == 1.4.*, however:
>>> from packaging.specifiers import SpecifierSet
>>> '1.4.6' in SpecifierSet('~=1.4.5a4', prereleases=True) # incorrect
False
>>> '1.4.6' in SpecifierSet('>=1.4.5a4, ==1.4.*', prereleases=True) # correct
True
It appears there has been a misinterpretation, treating ~=1.4.5a4 as >= 1.4.5a4, == 1.4.5.*. Compare this to PEP440: "If a pre-release, post-release or developmental release is named in a compatible release clause as V.N.suffix , then the suffix is ignored when determining the required prefix match".
My environment:
(venv) $ pip freeze
appdirs==1.4.2
attrs==16.3.0
chicken-turtle-util==4.0.1
lxml==3.7.3
numpy==1.12.0
packaging==16.8
patool==1.12
pkginfo==1.4.1
py==1.4.32
pypandoc==1.3.3
pyparsing==2.2.0
pytest==3.0.6
pytest-capturelog==0.7
requests==2.13.0
six==1.10.0
(venv) $ python --version
Python 3.5.2