acoustic-carpenter-78188
03/02/2026, 10:18 PMImage.with_code_bundle() method that configures automatic source code baking into Docker images when copy_style="none" is set in with_runcontext() or flyte deploy
• When copy_style is "loaded_modules" or "all", the layer is a no-op since code is bundled separately
• Supports two copy styles: "loaded_modules" (only imported Python modules) and "all" (entire root_dir)
• Adds resolve_code_bundle_layer() integration in _run_remote(), _run_hybrid(), and deploy.apply() before image builds
• Includes safety-net RuntimeError in docker_builder if a CodeBundleLayer reaches the build step unresolved
• Updates the full_build example to use the new simplified API
Test plan
• test_with_code_bundle_defaults — creates CodeBundleLayer with correct defaults
• test_with_code_bundle_all — stores "all" copy style
• test_with_code_bundle_custom_dst — stores custom destination
• test_resolve_code_bundle_no_layers — returns same object when no CodeBundleLayer present
• test_resolve_code_bundle_strips_when_not_none — strips layers when copy_style != "none"
• test_resolve_code_bundle_strips_when_all — strips layers when copy_style is "all"
• test_resolve_code_bundle_hash_stability — stripped image URI matches base image URI
• test_resolve_code_bundle_all_copy_style_none — replaces with CopyConfig for "all" + "none"
• test_resolve_code_bundle_loaded_modules_copy_style_none — creates staging dir for "loaded_modules" + "none"
• All 37 existing tests in test_image.py pass (no regressions)
flyteorg/flyte-sdkacoustic-carpenter-78188
03/04/2026, 1:13 AM