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

MyPy error on @metrics.log_metrics(capture_cold_start_metric=True) #743

Closed
michaelbrewer opened this issue Oct 7, 2021 · 2 comments · Fixed by #744
Closed

MyPy error on @metrics.log_metrics(capture_cold_start_metric=True) #743

michaelbrewer opened this issue Oct 7, 2021 · 2 comments · Fixed by #744
Labels
bug Something isn't working

Comments

@michaelbrewer
Copy link
Contributor

michaelbrewer commented Oct 7, 2021

What were you trying to accomplish?

Run MyPy linter on code:

from aws_lambda_powertools import Metrics

metrics = Metrics()

@metrics.log_metrics(capture_cold_start_metric=True)
def handler(event, context) -> Dict[str, str]:
    ...

Expected Behavior

No MyPy errors should be returned

Current Behavior

Mypy error Mypy: <nothing> not callable is returned on line @metrics.log_metrics(capture_cold_start_metric=True)

Possible Solution

Environment

  • Powertools version used: 1.21.0
  • Packaging format (Layers, PyPi): PyPi
  • AWS Lambda function runtime: Python 3.9
  • Debugging logs
@michaelbrewer michaelbrewer added bug Something isn't working triage Pending triage from maintainers labels Oct 7, 2021
@heitorlessa heitorlessa added area/metrics and removed triage Pending triage from maintainers labels Oct 7, 2021
@heitorlessa
Copy link
Contributor

Sadly it's a regression after adding callable types in the return to fix one thing - I couldn't catch that with mypy somehow running locally.

Now it's the time to ignore the areas we won't be able to fix with MyPy anytime soon (Parameters/Logger), and add it at CI level to catch it early.

@heitorlessa
Copy link
Contributor

Coming shortly in a patch releae

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants