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

DeprecationWarning for distutils in Python 3.10 (will be removed in Python 3.12) #906

Closed
nayaverdier opened this issue Dec 17, 2021 · 6 comments · Fixed by #921
Closed
Labels
p3 tech-debt Technical Debt tasks
Milestone

Comments

@nayaverdier
Copy link
Contributor

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)

  1. Use python3.10
  2. Activate a new venv (python3.10 -m venv .venv and . .venv/bin/activate)
  3. pip install aws-lambda-powertools pytest
  4. echo "import aws_lambda_powertools" > reproduce.py
  5. 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.

@nayaverdier nayaverdier added bug Something isn't working triage Pending triage from maintainers labels Dec 17, 2021
@boring-cyborg
Copy link

boring-cyborg bot commented Dec 17, 2021

Thanks for opening your first issue here! We'll come back to you as soon as we can.

@michaelbrewer
Copy link
Contributor

It will be tricky to support both 3.6 and 3.12 at the same time

By the time 3.10 runtime is officially launched, python 3.6 would be deprecated?

@heitorlessa heitorlessa added p3 internal Maintenance changes and removed bug Something isn't working triage Pending triage from maintainers labels Dec 17, 2021
@heitorlessa
Copy link
Contributor

@nayaverdier thanks for raising the issue.

Lambda runtime does not support 3.10 yet hence why this hasn't been actioned.

@nayaverdier
Copy link
Contributor Author

Would a PR on this be helpful or would it not be considered until 3.10 (or 3.12) is a supported lambda runtime?

@michaelbrewer
Copy link
Contributor

@nayaverdier 3.10 support comes sooner ;)

@heitorlessa
Copy link
Contributor

Would a PR on this be helpful or would it not be considered until 3.10 (or 3.12) is a supported lambda runtime?

I'd love a PR! I would take any help I can get ;-)

@heitorlessa heitorlessa added this to the 1.24.0 milestone Dec 21, 2021
@heitorlessa heitorlessa added tech-debt Technical Debt tasks and removed internal Maintenance changes labels Apr 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
p3 tech-debt Technical Debt tasks
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants