youtype / mypy_boto3_builder

Type annotations builder for boto3 compatible with VSCode, PyCharm, Emacs, Sublime Text, pyright and mypy.
https://youtype.github.io/mypy_boto3_builder/
MIT License
544 stars 36 forks source link

EC2 InstanceTypeDef.Platform Literal incorrectly capitalized #245

Closed andrew-womeldorf closed 7 months ago

andrew-womeldorf commented 7 months ago

Describe the bug EC2 InstanceTypeDef - the Platform field is typed NotRequired[Literal["Windows"]], which is so close to being correct it hurts that it's not 😂

To Reproduce Steps to reproduce the behavior:

  1. Install boto3-stubs[...]
  2. Run mypy/pyright on the following code sample
from mypy_boto3_ec2.type_defs import InstanceTypeDef
instance: InstanceTypeDef = {"Platform": "windows"}

Actual output

$ poetry run pyright
<path>/main.py
  <path>/main.py:2:42 - error: Expression of type "dict[str, str]" cannot be assigned to declared type "InstanceTypeDef"
    "Literal['windows']" cannot be assigned to type "Literal['Windows']" (reportAssignmentType)
1 error, 0 warnings, 0 informations

Additional context Your OS, boto3-stubs installation method, boto3 version, etc.

boto3-stubs 1.34.38

vemel commented 7 months ago

Hello! Thank you for the report.

Looks like it is because of a mistake in botocore shapes. I will cross-check all dependent methods and stub this enum if it is safe to do.

vemel commented 7 months ago

boto3 docs are also affected: https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/ec2/client/run_instances.html#

Notice that 'Platform': 'Windows',

andrew-womeldorf commented 7 months ago

Oooo, that's irritating. I wonder if it's worthwhile to accept either casing

vemel commented 7 months ago

I created a bug report: https://github.com/boto/botocore/issues/3128

No, looks like it is always windows, so I am going to temporarily stub this value until the bug is fixed.

vemel commented 7 months ago

@andrew-womeldorf fixed in mypy-boto3-ec2 1.34.50. Please update and let me know if it works as it should.

andrew-womeldorf commented 7 months ago

Fixed! Thank you very much!