pythonic-emacs / anaconda-mode

Code navigation, documentation lookup and completion for Python.
GNU General Public License v3.0
706 stars 87 forks source link

replace distutils.version by packaging.version #423

Closed enikar closed 1 year ago

enikar commented 1 year ago

In Python 3.10 (the version used in debian/sid, for now), distutils is deprecated. PEP 632 recommends to use packaging.version instead of distutils.version.

I suggest to replace the line: from distutils.version import LooseVersion by from packaging import version And use version.parse instead of LooseVersion.

Unfortunately, that means to look for packaging package which is not in standard python distribution.

dakra commented 1 year ago

We only use it to check for the current jedi version (https://github.com/pythonic-emacs/anaconda-mode/blob/160e4e7185881233d96da6722332bd6d038187a9/anaconda-mode.py#L110)

Mainly to check for Python3 compatibility. I think instead of pulling in packaging in this bootstrap phase just for that is a bit much. Maybe we can roll our own very simple version. Doesn't even have to work for all different kind of version string.. just like the jedi ones e.g. 0.17.2 or 0.18.1. Maybe a simple ver[4:] > dep[4:] or something is even enough. Do you want to try and find a solution and create a PR?

Thanks.

enikar commented 1 year ago

well, today I wrote a weak solution. It was a little more complex that what you said. But I don't know how to create a PR… I juste create a patch, at the moment.

enikar commented 1 year ago

Finally, I found how pull requests work.

dakra commented 1 year ago

Closed in https://github.com/pythonic-emacs/anaconda-mode/pull/424