acoustic-carpenter-78188
02/13/2026, 9:03 PMextendable parameter to the Image class to control whether additional layers can be added to an image after creation. This feature enables users to:
• Create base images that can be extended with additional layers (default behavior)
• Lock down final production images to prevent accidental modifications
• Explicitly control image mutability throughout the image building pipeline
## Changes
### Core Implementation
• Added extendable: bool = field(default=True) to the Image dataclass
• Updated Image.clone() method to accept and preserve the extendable parameter
• Added validation in clone() to prevent adding layers to non-extendable images
• The extendable property is preserved when cloning without explicitly specifying it
### Examples Updated
Updated all examples that use .clone() followed by layer additions to explicitly set `extendable=True`:
• examples/basics/frames.py
• examples/connectors/databricks_example.py
• examples/genai/anthropic_deep_research_agent.py
• examples/genai/anthropic_pbj_agent.py
• examples/image/clone_existing_image.py (with documentation)
• examples/image/private_base_image.py
• examples/plugins/spark_dataframe_example.py
• examples/plugins/spark_example.py
### New Example
• Added examples/image/extendable_image.py demonstrating comprehensive usage of the extendable parameter
### Tests
Added comprehensive unit tests covering:
• Default extendable behavior
• Setting extendable to False
• Preventing layer additions to non-extendable images
• Preserving extendable value on clone
• Changing extendable value on clone
• Allowing layers on extendable images
## Behavior
Default (extendable=True):
img = Image.from_debian_base(registry="ghcr.io/myorg", name="myapp")
img = img.with_pip_packages("numpy") # ✓ Works
Non-extendable (extendable=False):
img = Image.from_debian_base(registry="ghcr.io/myorg", name="myapp")
final_img = img.clone(name="final", extendable=False)
final_img.with_pip_packages("numpy") # ✗ Raises ValueError
Making extendable again:
new_img = final_img.clone(name="new", extendable=True)
new_img.with_pip_packages("numpy") # ✓ Works
## Test Plan
1. Run unit tests: pytest tests/flyte/test_image.py::test_extendable*
2. Verify examples run without errors
3. Test that non-extendable images properly reject layer additions
4. Verify backward compatibility - existing code continues to work (default is True)
## Breaking Changes
None. This is a backward-compatible addition with extendable=True as the default.
flyteorg/flyte-sdkacoustic-carpenter-78188
02/17/2026, 8:41 PM