diff --git a/changelogs/fragments/soft-deprecate-six.yml b/changelogs/fragments/soft-deprecate-six.yml new file mode 100644 index 00000000000..2f6a54b3ea8 --- /dev/null +++ b/changelogs/fragments/soft-deprecate-six.yml @@ -0,0 +1,3 @@ +deprecated_features: +- > + ``ansible.module_utils.six`` - The ``six`` compatibility library provided at ``ansible.module_utils.six`` is deprecated, and planned for removal in ansible-core 2.24 diff --git a/lib/ansible/module_utils/six/__init__.py b/lib/ansible/module_utils/six/__init__.py index 20504cbeddb..98015bacfe0 100644 --- a/lib/ansible/module_utils/six/__init__.py +++ b/lib/ansible/module_utils/six/__init__.py @@ -33,6 +33,8 @@ import operator import sys import types +# deprecated: description="Replace with ansible.module_utils.common.warnings.deprecate for 2.24" core_version="2.22" + # The following makes it easier for us to script updates of the bundled code. It is not part of # upstream six _BUNDLED_METADATA = {"pypi_name": "six", "version": "1.17.0"} diff --git a/test/lib/ansible_test/_util/controller/sanity/pylint/plugins/unwanted.py b/test/lib/ansible_test/_util/controller/sanity/pylint/plugins/unwanted.py index 324084eeee6..e196e90c688 100644 --- a/test/lib/ansible_test/_util/controller/sanity/pylint/plugins/unwanted.py +++ b/test/lib/ansible_test/_util/controller/sanity/pylint/plugins/unwanted.py @@ -110,6 +110,10 @@ class AnsibleUnwantedChecker(BaseChecker): 'Iterator', ) ), + + 'ansible.module_utils.six': UnwantedEntry( + 'the Python standard library equivalent' + ), } unwanted_functions = { @@ -134,14 +138,6 @@ class AnsibleUnwantedChecker(BaseChecker): modules_only=True), } - def __init__(self, *args, **kwargs) -> None: - super().__init__(*args, **kwargs) - # ansible.module_utils.six is deprecated and collections can still use it until it is removed - if self.is_ansible_core: - self.unwanted_imports['ansible.module_utils.six'] = UnwantedEntry( - 'the Python standard library equivalent' - ) - @functools.cached_property def is_ansible_core(self) -> bool: """True if ansible-core is being tested."""