Closed ChrisHills463 closed 7 months ago
The linting error looks like its being raised when the metrics publisher decorator is used: https://github.com/aws/aws-sam-cli-app-templates/blob/ccd6c098c35880495d6dd5a1b710a20831c62791/python3.11/hello-pt/%7B%7B%20cookiecutter.project_name%20%7D%7D/hello_world/app.py#L59-L60
We don't actually maintain the powertools library, the best way forward to get the typing fixed would be to reach out to the Powertools team: https://github.com/aws-powertools/powertools-lambda-python to create an issue there.
In the meantime, it should be possible to ignore the linting issue for now with:
@metrics.log_metrics(capture_cold_start_metric=True) # pyright: ignore[reportGeneralTypeIssues]
For anyone else finding this bug, I have spoken to the powertools team and they accepted a new bug report. Also worth noting is that the root issue appears to be with pyright, however it can be mitigated within the library.
Issue seems to be coming from Powertools, resolving.
Description:
When installing the sample hello-world app, there is a type error reported in
hello_world/app.py
Steps to reproduce:
Install
pyright
or any other Python type checker Installaws-lambda-powertools
withpip
Run the following commandsObserved result:
Expected result:
No errors reported.
Additional environment details (Ex: Windows, Mac, Amazon Linux etc)
sam --version
:1.114