Summary
After upgrading from constructs 10.4.2 to 10.4.3, my dependency manager began pulling in
typeguard 4.x (instead of <3), which caused AWS CDK (aws-cdk-lib) to emit large numbers of
runtime warnings during cdk synth and bundling operations.
Downgrading constructs back to 10.4.2 immediately caused typeguard to be resolved
back to 2.x, and the warnings disappeared.
This suggests that constructs 10.4.3 has relaxed or altered its dependency constraints in a way
that allows jsii to resolve to a version compatible with typeguard>=4, which is currently
not fully compatible with CDK’s runtime type checking behavior.
Environment
- Python 3.13
- aws-cdk-lib: 2.223.0
- jsii: resolved via constructs (1.119.0)
- typeguard: 2.13.3 → 4.2.1 after upgrading constructs
Impact
typeguard 4.x introduces strict Protocol checking, and CDK uses many non-runtime-checkable
Protocols (IRole, IVpc, IFunction, etc.). This results in hundreds of warnings, like the following:
UserWarning: Typeguard cannot check the IRole protocol because it is a non-runtime protocol. If you would like to type check this protocol, please use @typing.runtime_checkable
typeguard.check_type(value=value, expected_type=expected_type, collection_check_strategy=typeguard.CollectionCheckStrategy.ALL_ITEMS) # type:ignore
Summary
After upgrading from
constructs 10.4.2to10.4.3, my dependency manager began pulling intypeguard 4.x(instead of <3), which caused AWS CDK (aws-cdk-lib) to emit large numbers ofruntime warnings during
cdk synthand bundling operations.Downgrading
constructsback to10.4.2immediately causedtypeguardto be resolvedback to
2.x, and the warnings disappeared.This suggests that
constructs 10.4.3has relaxed or altered its dependency constraints in a waythat allows
jsiito resolve to a version compatible withtypeguard>=4, which is currentlynot fully compatible with CDK’s runtime type checking behavior.
Environment
Impact
typeguard 4.xintroduces strict Protocol checking, and CDK uses many non-runtime-checkableProtocols (
IRole,IVpc,IFunction, etc.). This results in hundreds of warnings, like the following: