This repository was archived by the owner on Feb 21, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 332
This repository was archived by the owner on Feb 21, 2023. It is now read-only.
Replace distutils.versions with packaging.versions #1306
Copy link
Copy link
Open
Labels
Description
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
kevinvalk