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

Static typing: @metrics.log_metrics decorator #4088

Open
ChrisHills463 opened this issue Apr 8, 2024 · 3 comments
Open

Static typing: @metrics.log_metrics decorator #4088

ChrisHills463 opened this issue Apr 8, 2024 · 3 comments
Assignees
Labels
typing Static typing definition related issues (mypy, pyright, etc.)

Comments

@ChrisHills463
Copy link

Static type checker used

pyright/pylance

AWS Lambda function runtime

3.11

Powertools for AWS Lambda (Python) version

latest

Static type checker info

# error: Argument missing for parameter "context" (reportGeneralTypeIssues)

Code snippet

@metrics.log_metrics(capture_cold_start_metric=True)   # error: Argument missing for parameter "context" (reportGeneralTypeIssues)
def lambda_handler(event: dict, context: LambdaContext) -> dict:
    return app.resolve(event, context)

Possible Solution

This is a known issue with pyright (see pyright#3265). See also this Discord discussion.

@ChrisHills463 ChrisHills463 added triage Pending triage from maintainers typing Static typing definition related issues (mypy, pyright, etc.) labels Apr 8, 2024
Copy link

boring-cyborg bot commented Apr 8, 2024

Thanks for opening your first issue here! We'll come back to you as soon as we can.
In the meantime, check out the #python channel on our Powertools for AWS Lambda Discord: Invite link

@ChrisHills463 ChrisHills463 changed the title Static typing: TITLE Static typing: @metrics.log_metrics decorator Apr 8, 2024
@rubenfonseca rubenfonseca self-assigned this Apr 8, 2024
@rubenfonseca
Copy link
Contributor

Confirmed I'm seeing this too. Added to the backlog. Thank you for opening this @ChrisHills463

@leandrodamascena
Copy link
Contributor

I'm not sure if it's related (I haven't checked), but we recently had a small refactoring on some parts of this code:

https://github.com/aws-powertools/powertools-lambda-python/pull/3460/files#diff-49bfc9264b598c920d5bef978e668726dc09f7a8fc27f4aae974849ecab60ee2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
typing Static typing definition related issues (mypy, pyright, etc.)
Projects
Status: Backlog
Development

No branches or pull requests

3 participants