zsoldosp / django-currentuser

Conveniently store reference to request user on thread/db level.
BSD 3-Clause "New" or "Revised" License
157 stars 40 forks source link

Fixed compatibility issue. #31

Closed serafdev closed 5 years ago

serafdev commented 5 years ago

On pip install django-currentuser we get this stacktrace:

ERROR: django-currentuser 0.4.1 has requirement Django<2.0,>=1.11.17,
but you'll have django 2.2.2 which is
incompatible.
ERROR: django-currentuser 0.4.1 has requirement Django<2.2,>=2.1.8;
python_version > "3.4", but you'll have
django 2.2.2 which is incompatible.

Also the TravisCI builds were failing.

zsoldosp commented 5 years ago

@serafss2 thanks for the initiative to make a PR! As per https://docs.djangoproject.com/en/dev/faq/install/#what-python-version-can-i-use-with-django 2.2 Django this change would render the package not installable for python 2/django 1.11 and python 3.4/django 2.0

I would be the happiest to have one line per django version, clearly stating the supported python/django version ranges (which would make it rather easy to drop versions)

Also, when making changes to python-django combinations, please update the tox.ini config too - not sure whether .travis.yml is automatically updated or need to run ./tox2travis.py > .travis.yml by hand

related issues are #28 and #30

serafdev commented 5 years ago

Thank you for your answer @zsoldosp , how do you think I should fix the builds failing here:

https://travis-ci.org/PaesslerAG/django-currentuser/builds/529192673

Edit: Nevermind just saw that it was fixed on master and is unrelated to my logs, should I change it to this then?:

'Django>=1.11.17,<2.3', 
zsoldosp commented 5 years ago

@serafss2 I think the root cause of the problem is that the first line of the install_requires is not bound by python version, thus always gets applied. I would structure it the following way - so it's clear which django and which python versions apply (based on https://www.djangoproject.com/download/#supported-versions and https://docs.djangoproject.com/en/dev/faq/install/#what-python-version-can-i-use-with-django)

...
install_requires=[
    'Django>=1.11.0,<2.0;python_version<"3.5"',  # 1.11 with 2.7 - 3.4 versions
    'Django>=2.1.8,<2.2;python_version>"3.4"', # 2.1 with 3.5, 3.6, 3.7 - though will be problematic with 3.8?
    'Django>=2.2.1,<2.3;python_version>"3.4"',  # 2.2 with 3.5, 3.6, and 3.7
],
...

now probably there is a way to add multiple python qualifiers, but I haven't worked with setuptools in a while, am not involved in the release process for this library currently, and https://www.python.org/dev/peps/pep-0508/ was quite a heavy reading to parse immediately also, see #32

serafdev commented 5 years ago

Yes I think you are right about the python_version missing @zsoldosp Thank you, I think we should close this and redirect to issue #32