from aws_cdk.core import ( BundlingDockerImage, BundlingOptions, ILocalBundling ) from aws_cdk.aws_lambda import Code from jsii import implements, member @implements(ILocalBundling) class MyLocalBundler: @member(jsii_name="tryBundle") def try_bundle(self, output_dir: str, options: BundlingOptions) -> bool: # ... do stuff, return bool ... return True my_local_bundler = MyLocalBundler() my_code = Code.from_asset( path=path.join(".."), exclude=["*.pyc"], asset_hash_type=AssetHashType.BUNDLE, bundling=BundlingOptions( image=BundlingDockerImage.from_registry( "dummy" ), # We are not going to use Docker Bundling, but the image parameter needs to be set. local=my_local_bundler, ), )