adamchainz / gargoyle

:radio_button: Feature switches in Django
Apache License 2.0
109 stars 19 forks source link

Pin django-modeldict dependency in Python 2 #230

Closed adamantike closed 5 years ago

adamantike commented 5 years ago

django-modeldict-yplan has removed support for Python 2 in its 2.0.0 release [0]. Being this Python version not supported anymore, but still supported in this project, we need to pin its version to never use 2.x in Python 2.

Current error when using a Python 2 virtualenv:

$ pip install gargoyle-yplan
DEPRECATION: Python 2.7 will reach the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 won't be maintained after that date. A future version of pip will drop support for Python 2.7.
Looking in indexes: http://localhost:3141/root/pypi/+simple/
Collecting gargoyle-yplan
  Downloading http://localhost:3141/root/pypi/+f/93e/2e3d2767aceb1/gargoyle_yplan-1.5.0-py2.py3-none-any.whl (49kB)
    100% |████████████████████████████████| 51kB 253kB/s
Collecting django-modeldict-yplan>=1.5.0 (from gargoyle-yplan)
  Downloading http://localhost:3141/root/pypi/+f/f45/ba978634464b9/django_modeldict_yplan-2.0.0-py2.py3-none-any.whl
django-modeldict-yplan requires Python '>=3.4' but the running Python is 2.7.15

[0] https://github.com/adamchainz/django-modeldict/blob/master/HISTORY.rst#200-2019-01-29

adamantike commented 5 years ago

This is now only needed for gargoyle-yplan < 2.0.0

adamchainz commented 5 years ago

Hi @adamantike,

I dug into this mess a bit more. The reason pip on Python 2 was still pulling down django-modeldict-yplan 2.0.0 after I removed the universal wheel is the metadata requires_python on PyPI for that version was unmodified, left as the empty string, meaning "no known restrictions so just try it". Therefore pip would down the wheel, then try install it and hit the version specifier locally as incompatible.

I contacted PyPI devs on IRC and there is no way of modifying the metadata.

Therefore, as a workaround, I've released django-modeldict-yplan 2.0.1 as a new version that has the corrected requires_python since universal wheels are disabled. I'll pull version 2.0.0 after 2 weeks, as a way of allowing users a fair window to "upgrade" to the new version. Since you're the only one reporting this issue, and already pin your requirements, I think this is a fair compromise.

This will mean the pin on gargoyle won't be required, as Pip on Python 2 will resolve the dependency to the 1.X series of django-modeldict-yplan. Therefore, this PR won't be required after the version 2.0.0.

Thanks for helping on this, it tracked down a subtle error that I won't be making as I drop Python 2 support from my other maintained open source packages.

Thanks,

Adam

adamchainz commented 5 years ago

I've now pulled version 2.0.0.

adamantike commented 5 years ago

Thanks @adamchainz ! I can confirm this is fixed. Trying to install Gargoyle on Python 2 retrieves 1.5.0 instead of 2.x.

adamchainz commented 5 years ago

Thanks for confirming.