acoustic-carpenter-78188
09/27/2025, 5:09 AMLiteral to a literal primitive
## What changes were proposed in this pull request?
Add a Literal transformer
## How was this patch tested?
Unit test
and
Run the below workflow
from flytekit import task, workflow, ImageSpec
import flytekit
from typing import Literal
@task
def my_task(feature: Literal["outcome", "income"]) -> str:
return f"feature: {feature}"
@workflow
def wf(feature: Literal["outcome", "income"]) -> str:
return my_task(feature=feature)
## Screenshots?
[image](https://private-user-images.githubusercontent.com/48407047/481923065-c7617db5-c2cf-4a6f-a577-13692568b0dc.png?jwt=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3NTg5NTAwNDIsIm5iZiI6MTc1ODk0OTc0MiwicGF0aCI6Ii80ODQwNzA0Ny80ODE5MjMwNjUtYzc2MTdkYjUtYzJjZi00YTZmLWE1NzctMTM2OTI1NjhiMGRjLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNTA5MjclMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjUwOTI3VDA1MDkwMlomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPWRmNDcyYTQ0YzgzMDdiMmI4YWM0NGYzNGE1ZDE4MTJjZjgwNTk2ZTVkOTlkNWY4ODI0ZmNkNTI3NDZmYTE3ZDImWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0In0.BU4HP4J4hVIWsJ76h3XTszP1ApmsylVdhzeFm79a_Ls)
## Check all the applicable boxes
• I updated the documentation accordingly.
• All new and existing tests passed.
• All commits are signed-off.
https://bito.ai#summarystart|
### Summary by Bito
This pull request introduces a new Literal transformer in the Flyte framework, enhancing the type engine's ability to serialize Literal types into primitive types. It improves data type handling and usability in type management, and includes methods for converting between Literal and Python values. Unit tests have been added to verify the new functionality.
flyteorg/flytekitacoustic-carpenter-78188
09/27/2025, 5:09 AM