aws-cloudformation / cloudformation-cli

The CloudFormation Provider Development Toolkit allows you to author your own resource providers and modules that can be used by CloudFormation.
Apache License 2.0
319 stars 161 forks source link

Syntax warnings on Python 3.12 #1088

Open siennathesane opened 1 month ago

siennathesane commented 1 month ago

When running cfn on Python 3.12, it throws this syntax error:

$ cfn --version
/opt/homebrew/Cellar/cloudformation-cli/0.2.38/libexec/lib/python3.12/site-packages/rpdk/core/contract/hook_client.py:451: SyntaxWarning: invalid escape sequence '\s'
  regex = "__CFN_HOOK_START_RESPONSE__([\s\S]*)__CFN_HOOK_END_RESPONSE__"  # noqa: W605,B950 # pylint: disable=C0301
/opt/homebrew/Cellar/cloudformation-cli/0.2.38/libexec/lib/python3.12/site-packages/rpdk/core/contract/resource_client.py:738: SyntaxWarning: invalid escape sequence '\s'
  regex = "__CFN_RESOURCE_START_RESPONSE__([\s\S]*)__CFN_RESOURCE_END_RESPONSE__"  # noqa: W605,B950 # pylint: disable=C0301
cfn 0.2.38
Scribbd commented 1 month ago

How did you install Python, and how are you running cfn-cli?

If cfn-cli or Python was installed via brew, I noticed this occurring with many of my tools that used the brew python as the base environment after an update to Python. I use pipx and reinstalled all tools with a 3.12 runtime created by pyenv.

I had to reinstall python from scratch to resolve the issues I was facing for the tools that do not work well within pipx.

siennathesane commented 1 month ago

I installed it with pip install cloudformation-cli using my homebrew python