Skip to content
This repository has been archived by the owner on Feb 21, 2023. It is now read-only.

Replace distutils.versions with packaging.versions #1306

Open
1 task done
tier-jani opened this issue Mar 1, 2022 · 0 comments · May be fixed by #1308
Open
1 task done

Replace distutils.versions with packaging.versions #1306

tier-jani opened this issue Mar 1, 2022 · 0 comments · May be fixed by #1308

Comments

@tier-jani
Copy link

Is your feature request related to a problem?

Using aioredis as dependency in projects using setuptools > 59.5.0 throw DeprecationWarning for using StrictVersion from distutils:

$ pytest tests/test_connection.py
/Users/janosmolnar/aioredis-py/venv/lib/python3.10/site-packages/pytest_sugar.py:169: DeprecationWarning: distutils Version classes are deprecated. Use packaging.version instead.
  xdist_version = LooseVersion(xdist.__version__)
/Users/janosmolnar/aioredis-py/venv/lib/python3.10/site-packages/pytest_sugar.py:170: DeprecationWarning: distutils Version classes are deprecated. Use packaging.version instead.
  if xdist_version >= LooseVersion('1.14'):
Test session starts (platform: darwin, Python 3.10.2, pytest 6.2.5, pytest-sugar 0.9.4)
rootdir: /Users/janosmolnar/aioredis-py, configfile: pyproject.toml
plugins: asyncio-0.16.0, sugar-0.9.4, forked-1.4.0, xdist-2.4.0, cov-3.0.0
collecting ...
 tests/test_connection.py ✓✓✓✓✓✓✓✓✓                                                        100% ██████████
============================================ warnings summary ============================================
aioredis/connection.py:68
  /Users/janosmolnar/aioredis-py/aioredis/connection.py:68: DeprecationWarning: distutils Version classes are deprecated. Use packaging.version instead.
    hiredis_version = StrictVersion(hiredis.__version__)

aioredis/connection.py:69
  /Users/janosmolnar/aioredis-py/aioredis/connection.py:69: DeprecationWarning: distutils Version classes are deprecated. Use packaging.version instead.
    if hiredis_version < StrictVersion("1.0.0"):

This can become a problem if running tests with warning capture option -w Error (so that warnings are raised as errors):
https://docs.python.org/3/using/cmdline.html#cmdoption-w

Otherwise the used disutils.versions.StrictVersion will be removed in later versions of distutils, so it makes sense to replace.

Describe the solution you'd like

Replace disutils.versions.StrictVersion as suggested in DeprecationWarning with packaging.version

Describe alternatives you've considered

I don't see a better alternative.

Additional context

No response

Code of Conduct

  • I agree to follow the aio-libs Code of Conduct
tier-jani added a commit to tier-jani/aioredis-py that referenced this issue Mar 1, 2022
This removes `DeprecationWarnings` raised by `distutils`.

Fixes aio-libs-abandoned#1306
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
1 participant