Skip to content

Conversation

@maxrabin
Copy link
Contributor

@maxrabin maxrabin commented Jan 8, 2026

Issue number: closes #7923

Summary

Changes

Changed the event parameter type annotation from dict to dict[str, Any] in both process_partial_response and async_process_partial_response functions in aws_lambda_powertools/utilities/batch/decorators.py.

User experience

Before: When using strict type checkers like pyright, users would see type errors:

error: Type of "process_partial_response" is partially unknown
  Type of "process_partial_response" is "(event: dict[Unknown, Unknown], ...)" (reportUnknownVariableType)

After: Type checkers correctly infer event: dict[str, Any], eliminating the type error and providing better IDE support and type safety.


By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

Change event parameter type from 'dict' to 'dict[str, Any]' in
process_partial_response and async_process_partial_response functions.

Lambda events are JSON objects which should be typed as dict[str, Any]
for better type checking with tools like pyright.

Fixes aws-powertools#7923
@maxrabin maxrabin requested a review from a team as a code owner January 8, 2026 09:11
@maxrabin maxrabin requested a review from sdangol January 8, 2026 09:12
@boring-cyborg
Copy link

boring-cyborg bot commented Jan 8, 2026

Thanks a lot for your first contribution! Please check out our contributing guidelines and don't hesitate to ask whatever you need.
In the meantime, check out the #python channel on our Powertools for AWS Lambda Discord: Invite link

@pull-request-size pull-request-size bot added the size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. label Jan 8, 2026
@leandrodamascena leandrodamascena changed the title fix(batch): improve type annotation for event parameter typing(batch): improve type annotation for event parameter Jan 8, 2026
@github-actions github-actions bot added the bug Something isn't working label Jan 8, 2026
@leandrodamascena leandrodamascena changed the title typing(batch): improve type annotation for event parameter refactor(batch): improve type annotation for event parameter Jan 8, 2026
@codecov
Copy link

codecov bot commented Jan 8, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 96.72%. Comparing base (4171897) to head (0a0dead).
⚠️ Report is 2 commits behind head on develop.

Additional details and impacted files
@@           Coverage Diff            @@
##           develop    #7924   +/-   ##
========================================
  Coverage    96.72%   96.72%           
========================================
  Files          275      275           
  Lines        13214    13214           
  Branches      1006     1006           
========================================
  Hits         12781    12781           
  Misses         325      325           
  Partials       108      108           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@github-actions github-actions bot added enhancement and removed bug Something isn't working labels Jan 8, 2026
@sonarqubecloud
Copy link

sonarqubecloud bot commented Jan 8, 2026

Copy link
Contributor

@leandrodamascena leandrodamascena left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks a lot for improving this @maxrabin! APPROVED!

@leandrodamascena leandrodamascena merged commit 4602ffc into aws-powertools:develop Jan 8, 2026
14 checks passed
@boring-cyborg
Copy link

boring-cyborg bot commented Jan 8, 2026

Awesome work, congrats on your first merged pull request and thank you for helping improve everyone's experience!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement size/XS Denotes a PR that changes 0-9 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Improve type annotation for event parameter in batch processing functions

2 participants