seeebiii/ses-verify-identities

Python is not working

Closed this issue · 6 comments

I can't get this to work with python. I have installed the package with pip, pip install ses_verify_identities

a snippet of code in my cdk stack that is relevant for this construct

from ses_verify_identities import VerifySesEmailAddress

VerifySesEmailAddress(self, "SesEmailVerification",
    email_address="hello@example.org"
)

the out put error message is

Traceback (most recent call last):
  File "app.py", line 16, in <module>
    AvailCdkDevStack(app, "AvailCdkDevStack",
  File "/Users/josh/Development/avail_cdk_dev/.venv/lib/python3.8/site-packages/jsii/_runtime.py", line 83, in __call__
    inst = super().__call__(*args, **kwargs)
  File "/Users/josh/Development/avail_cdk_dev/avail_cdk_dev/avail_cdk_dev_stack.py", line 44, in __init__
    VerifySesEmailAddress(self, "SesEmailVerification",
  File "/Users/josh/Development/avail_cdk_dev/.venv/lib/python3.8/site-packages/jsii/_runtime.py", line 83, in __call__
    inst = super().__call__(*args, **kwargs)
TypeError: __init__() got an unexpected keyword argument 'email_address'
Subprocess exited with error 1

any ideas what Im doing wrong?

I am seeing some other people having issues with jsii, i think that may be the issue for python users, -> aws/jsii#2929

@joshdlee Not sure how I could you there.. I subscribed the issue to get notified about updates there, e.g. if I can fix something in the code. Or if you have an idea, please let me know.

To add more context here: https://aws.github.io/jsii/user-guides/lib-author/typescript-restrictions/

The key snippet being

Interfaces

The jsii type model distinguishes two kinds of interfaces:

Behavioral interfaces, which can declare methods and properties
Structs, which are immutable pure data entities, and can consequently only declare readonly properties

A name convention is used to distinguish between these two: behavioral interfaces must have a name that starts with a I prefix, while structs must not have such a prefix.

The issue is that the construct props are being specified as a behavioral interface rather than a struct because they are prepended with an I (IVerifySesDomainProps and IVerifySesEmailAddressProps). This doesn't just affect Python, all non-Typescript versions of this library will not work due to this issue.

There's two potential fixes:

  1. Drop the I from the prop interfaces
  2. Use type hinting to coerce the interfaces into structs: https://aws.github.io/jsii/user-guides/lib-author/hints/#forcing-an-interface-to-be-considered-a-struct

Option 1 would be a backwards incompatible change for current Typescript users, but the most correct. While 2 wouldn't break anything for existing Typescript users. I'll go ahead and send a PR for option 2. I'll leave it up to @seeebiii if he wants to pursue option 1 in a future major version release.

@seeebiii this can be closed now that #502 has been merged to main

This issue is now marked as stale because it hasn't seen activity for a while. Add a comment or it will be closed soon.

Closing this issue as it hasn't seen activity for a while. Please add a comment @mentioning a maintainer to reopen.