Closed xquek closed 10 months ago
Thank you for your contribution!
Looks good to me. Please test how it works and move PR to ready for review once tested.
Let me know if you need any help with testing.
Thanks @vemel, what are your recommended steps for testing? do i write tests for it or it is more of a manual testing?
I do not think we need automated tests, so manual testing is enough.
Find type_defs = result.get_type_defs()
line in mypy_boto3_builder/parsers/service_package_parser.py
. This is where you want to add your new type annotations.
from mypy_boto3_builder.service_name import ServiceNameCatalog
...
type_defs = result.get_type_defs()
# Add hardcoded CloudwatchEvent type definitions to cloudwatch service
if self.service_name == ServiceNameCatalog.cloudwatch:
type_defs.add(CloudwatchEventTypeDef)
mypy-boto3-cloudwatch
poetry shell
# generate ./mypy_boto3_output/mypy_boto3_cloudwatch_package
./scripts/build.sh -s cloudwatch--product boto3-service
# install generated `mypy-boto3-cloudwatch`
./scripts/install.sh cloudwatch
test.py
in project root with this contentsfrom mypy_boto3_cloudwatch.type_defs import CloudwatchEventTypeDef, CloudwatchEventMetricStatsMetricTypeDef
# checking that event is type checked correctly
my_event: CloudwatchEventTypeDef = {...}
# checking that underlying TypeDefs were also added to `mypy_boto3_cloudwatch`
metric_stats: CloudwatchEventMetricStatsMetricTypeDef = {...}
Run pyright test.py
or mypy test.py
and check if it verifies types correctly.
@xquek please let me know if you have time to finish this PR. If not - I can merge it as it is and do the rest.
Hi @vemel, apologies havent had the time to work on it this week yet. i think it might be faster for you to merge it and complete it - sorry about that
No worries. Thank you a lot for your contribution 🥇
Please undraft the PR once you stop working on it.
Done! And thank you,!
Notes
I base my types using examples from
In cloudwatch-and-eventbridge.html, there are several different event types (or detail-type). I was wondering do we need to create different type def for different event. (detail-type)
I am also not sure how accurate the examples are - if you know of a better source for reference, do let me know!
I havent add any UT, let. me know what i should add.
Type of change
Checklist
All of these are optional:
./scripts/before_commit.sh
to follow the style guidelines of this project ( i recieved: mypy_boto3_builder/type_maps/typed_dicts.py:209: unused variable 'CloudwatchEventTypeDef' (60% confidence))Thank you!