django-js-reverse icon indicating copy to clipboard operation
django-js-reverse copied to clipboard

distutils has been deprecated in Python 3.10

Open tirkarthi opened this issue 3 years ago • 1 comments

https://www.python.org/dev/peps/pep-0632/#migration-advice

https://github.com/ierror/django-js-reverse/blob/7cab78c4531780ab4b32033d5104ccd5be1a246a/django_js_reverse/core.py#L6

tirkarthi avatar Dec 29 '21 05:12 tirkarthi

A potential gotcha here is that the rc version comparisons have changed between distutils and packaging:

In [1]: from distutils.version import LooseVersion, StrictVersion
In [2]: from packaging.version import Version

In [4]: LooseVersion('1.0-rc2') > LooseVersion('1.0')
Out[4]: True

In [5]: LooseVersion('1.0-rc2') >= LooseVersion('1.0')
Out[5]: True

In [6]: LooseVersion('1.0-rc2') < LooseVersion('1.0')
Out[6]: False

In [7]: Version('1.0-rc2') > Version('1.0')
Out[7]: False

In [8]: Version('1.0-rc2') >= Version('1.0')
Out[8]: False

In [9]: Version('1.0-rc2') < Version('1.0')
Out[9]: True

However given that the version in question is Django 2.0.x a simple alternative might be to drop support for Django < 3 and drop this version check entirely.

PeterJCLaw avatar Nov 15 '22 18:11 PeterJCLaw