Skip to content

Commit

Permalink
Deprecate the method aiida.get_strict_version (#5512)
Browse files Browse the repository at this point in the history
The method uses the `distutils` package of the standard library. With
the acceptance of PEP 632, this module was deprecated in Python 3.10 and
it will be removed in Python 3.12.

Since there is no exact replacement of the `StrictVersion` class in
another package, we deprecate the method and slate it for removal in the
next major version. We could have used `packaging.version.Version` as a
replacement, but the method is not used internally and doesn't seem to
be used by plugin packages either.
  • Loading branch information
sphuber authored May 12, 2022
1 parent 80d1125 commit abc735a
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions aiida/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,11 @@ def get_strict_version():
:rtype: :class:`!distutils.version.StrictVersion`
"""
from distutils.version import StrictVersion

from aiida.common.warnings import warn_deprecation
warn_deprecation(
'This method is deprecated as the `distutils` package it uses will be removed in Python 3.12.', version=3
)
return StrictVersion(__version__)


Expand Down

0 comments on commit abc735a

Please sign in to comment.