Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

distutils package is deprecated and slated for removal in Python 3.12 #701

Open
hloeung opened this issue Apr 28, 2022 · 2 comments · May be fixed by #888
Open

distutils package is deprecated and slated for removal in Python 3.12 #701

hloeung opened this issue Apr 28, 2022 · 2 comments · May be fixed by #888

Comments

@hloeung
Copy link
Contributor

hloeung commented Apr 28, 2022

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?

@hloeung
Copy link
Contributor Author

hloeung commented Nov 3, 2022

PEP 632 mentions using the packaging package for distutils.version. Looks like this https://packaging.pypa.io/en/latest/version.html#packaging.version.Version

@hloeung
Copy link
Contributor Author

hloeung commented Mar 13, 2024

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

@hloeung hloeung linked a pull request Apr 2, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants