raven-python icon indicating copy to clipboard operation
raven-python copied to clipboard

pip install of raven in new versions of python installing contextlib2 unecessarily

Open julianandrews opened this issue 8 years ago • 2 comments

Currently if you run pip install raven==6.1.0 with python 3.5.3 (and I'm guessing other versions of python) contextlib2 gets installed, though it should not be installed for python >= 3.2.

Running python setup.py for raven correctly installs just raven. I'm not sure if this is incorrect behavior in the raven package or in pip itself (since setup.py works fine), but I figured I'd raise the issue here in case the issue can be fixed by packaging.

julianandrews avatar Jun 22 '17 16:06 julianandrews

This could be fixed by changing installed_requires to something along the lines of:

install_requires = [
    'contextlib2; python_version < "3.2"'`,
]

However the only downside is that pip installing the wheel will still end up pulling in contextlib2 due to https://bitbucket.org/pypa/wheel/issues/181/bdist_wheel-silently-discards-pep-508. However extras_require will work with wheels:

extras_require={
    'flask': flask_requires,
    'tests': tests_require,
    ':python_version<"3.2"': ['contextlib2'],
},

https://hynek.me/articles/conditional-python-dependencies/ explains it in a bit more detail.

tomkins avatar Jun 24 '17 00:06 tomkins

contextlib2 is not necessary even for Python > 2.5, isn't it?

mcepl avatar Aug 10 '18 14:08 mcepl