-
Notifications
You must be signed in to change notification settings - Fork 4k
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
Python constructs do not implement their interfaces #13474
Comments
Haven't had time to try and reproduce yet - but this looks like it could be a versioning issue. Check your It's very possible something else is happening here, but let me know if that was the issue and if it's not I'll continue to investigate. |
Verified are all the same version. Looking at the python source you can see the issue, e.g. @jsii.interface(jsii_type="@aws-cdk/aws-ec2.IVpc")
class IVpc(aws_cdk.core.IResource, typing_extensions.Protocol):
@builtins.staticmethod
def __jsii_proxy_class__() -> typing.Type["_IVpcProxy"]: and @jsii.implements(IVpc)
class Vpc(
aws_cdk.core.Resource,
metaclass=jsii.JSIIMeta,
jsii_type="@aws-cdk/aws-ec2.Vpc",
): So @jsii.implements(IResource)
class Resource(
Construct,
metaclass=jsii.JSIIAbstractClass,
jsii_type="@aws-cdk/core.Resource",
):
'''A construct which represents an AWS resource.'''
@builtins.staticmethod
def __jsii_proxy_class__() -> typing.Type["_ResourceProxy"]: So |
Thank you for the additional information. I'll have @MrArnoldPalmer take a look at this |
@MrArnoldPalmer are there any updates regarding this? Do you need any help with reproducing it, or any other additional info? |
@gshpychka no updates from us right now but this is in our backlog. Any help investigating and fixing is greatly appreciated of course if you're comfortable digging into the aws/jsii repository. You should be able to add a test using jsii-calc to cover this which is a start. |
@MrArnoldPalmer I added a test that reproduces this, the failure looks like:
|
Actually my repro is a slightly different error. jsii-calc is structured very differently than the CDK and I was having trouble replicating the CDK structure in jsii-calc. My testcase results in the base class not having |
OK, I pushed a better test that reproduces the original issue more closely
|
Fixes aws/aws-cdk#13474 --- By submitting this pull request, I confirm that my contribution is made under the terms of the [Apache 2.0 license]. [Apache 2.0 license]: https://www.apache.org/licenses/LICENSE-2.0
|
Many constructs in python do not implement their corresponding interfaces (e.g.
aws_ec2.SecurityGroup
does not implementaws_ec2.ISecurityGroup
,Vpc
does not implementIVpc
,HostedZone
does not implmentIHostedZone
etc.)This causes typing errors since some methods are declared as accepting the interface and so will not accept the implementation.
Reproduction Steps
Run mypy on this:
What did you expect to happen?
No errors.
What actually happened?
Multiple typing errors.
Environment
Other
This is 🐛 Bug Report
The text was updated successfully, but these errors were encountered: