awslabs / awslabs/sagemaker-debugger-rulesconfig
Syntax warning that will become an error
- Dominant language
- Python
- Stars
- 8
- Forks
- 7
- PR merge metrics
- No merged PRs in 30d
Description
With Python 3.12.2, when I import the ,sagemaker sdk, an import of this package is triggered and I see
```python
***/site-packages/smdebug_rulesconfig/actions/utils.py:6: SyntaxWarning: invalid escape sequence '\w'
EMAIL_ADDRESS_REGEX = "^[a-z0-9]+[@]\w+[.]\w{2,3}$"
```
and a few others. For proper escaping, I think the easiest is to [use raw strings](https://adamj.eu/tech/2022/11/04/why-does-python-deprecationwarning-invalid-escape-sequence/), like `EMAIL_ADDRESS_REGEX = r"^[a-z0-9]+[@]\w+[.]\w{2,3}$"`, which should be fairly backwards compatible.
Also note that in the future, this warning will become an [error](https://docs.python.org/3/reference/lexical_analysis.html#escape-sequences):
> Changed in version 3.12: Octal escapes with value larger than 0o377 produce a [SyntaxWarning](https://docs.python.org/3/library/exceptions.html#SyntaxWarning). In a future Python version they will be eventually a [SyntaxError](https://docs.python.org/3/library/exceptions.html#SyntaxError).
Note this may conflict with the open PR #37.
Contributor guide
Assessment
This issue has not been assessed yet.