Closed
Description
What were you trying to accomplish?
Run tests utilizing aws-lambda-powertools.
Expected Behavior
No DeprecationWarning to appear.
Current Behavior
When running tests (specifically using pytest
) that import aws_lamdba_powertools
, a DeprecationWarning
appears.
.../aws_lambda_powertools/shared/functions.py:1: 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.util import strtobool
Possible Solution
The only function used out of distutils is strtobool
, and it is only used in one place, so that logic can simply be copied into the resolve_truthy_env_var_choice
function in aws_lambda_powertools.shared.functions
.
Steps to Reproduce (for bugs)
- Use python3.10
- Activate a new venv (
python3.10 -m venv .venv
and. .venv/bin/activate
) pip install aws-lambda-powertools pytest
echo "import aws_lambda_powertools" > reproduce.py
pytest reproduce.py
Environment
- Powertools version used:
1.22.0
- Packaging format (Layers, PyPi): PyPi
This warning appears in development workflows, but will be eventually breaking when Python 3.12 is released.