distutils package is deprecated and slated for removal in Python 3.12
Hi,
Seeing these warnings now:
.tox/unit/lib/python3.10/site-packages/charmhelpers/core/hookenv.py:21
/tmp/tmpfiles-hloeung/tmp/smtp-relay/.tox/unit/lib/python3.10/site-packages/charmhelpers/core/hookenv.py:21: DeprecationWarning: The distutils package is deprecated and slated for removal in Python 3.12. Use setuptools or check PEP 632 for potential alternatives
from distutils.version import LooseVersion
Can we fix this before Python 3.12?
PEP 632 mentions using the packaging package for distutils.version. Looks like this https://packaging.pypa.io/en/latest/version.html#packaging.version.Version
I'm currently using this in the content-cache charm. In wheelhouse.txt:
looseversion;python_version >= '3.12'
Then in the charm code:
try:
from distutils.version import LooseVersion
except ImportError:
from looseversion import LooseVersion