-
Notifications
You must be signed in to change notification settings - Fork 300
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
EnumType support in flytekit #509
Conversation
Example usage: ```python from enum import Enum class Color(Enum): RED = "red" BLUE = "blue" GREEN = "green" @task def foo(c: Color) -> str: return c.value ``` UI/UX: Drop down. RED will be the default value flytectl: enforce the value to be limited to one of the enum values Signed-off-by: Ketan Umare <[email protected]>
Codecov Report
@@ Coverage Diff @@
## master #509 +/- ##
==========================================
+ Coverage 85.28% 85.32% +0.03%
==========================================
Files 369 369
Lines 28002 28077 +75
Branches 2270 2273 +3
==========================================
+ Hits 23882 23957 +75
Misses 3501 3501
Partials 619 619
Continue to review full report at Codecov.
|
Walk the inheritance hierarchy of v and find a transformer that matches the first base class. | ||
This is potentially non-deterministic - will depend on the registration pattern. | ||
|
||
TODO lets make this deterministic by using an ordered dict |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
aren't python 3.6+ dicts ordered?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ohh really? let me check on that
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@cosmicBboy you are right, they are insertion order preserving as explained here, but not to be confused with ordered dicts. For our usecase we want OrderedDicts right? Insertion order depends on module load order, which can be arbitrary
Example usage: ```python from enum import Enum class Color(Enum): RED = "red" BLUE = "blue" GREEN = "green" @task def foo(c: Color) -> str: return c.value ``` UI/UX: Drop down. RED will be the default value flytectl: enforce the value to be limited to one of the enum values Signed-off-by: Ketan Umare <[email protected]> Signed-off-by: Haytham Abuelfutuh <[email protected]>
Example usage: ```python from enum import Enum class Color(Enum): RED = "red" BLUE = "blue" GREEN = "green" @task def foo(c: Color) -> str: return c.value ``` UI/UX: Drop down. RED will be the default value flytectl: enforce the value to be limited to one of the enum values Signed-off-by: Ketan Umare <[email protected]> Signed-off-by: Haytham Abuelfutuh <[email protected]>
Example usage: ```python from enum import Enum class Color(Enum): RED = "red" BLUE = "blue" GREEN = "green" @task def foo(c: Color) -> str: return c.value ``` UI/UX: Drop down. RED will be the default value flytectl: enforce the value to be limited to one of the enum values Signed-off-by: Ketan Umare <[email protected]> Signed-off-by: Haytham Abuelfutuh <[email protected]>
Example usage: ```python from enum import Enum class Color(Enum): RED = "red" BLUE = "blue" GREEN = "green" @task def foo(c: Color) -> str: return c.value ``` UI/UX: Drop down. RED will be the default value flytectl: enforce the value to be limited to one of the enum values Signed-off-by: Ketan Umare <[email protected]> Signed-off-by: wild-endeavor <[email protected]>
Example usage: ```python from enum import Enum class Color(Enum): RED = "red" BLUE = "blue" GREEN = "green" @task def foo(c: Color) -> str: return c.value ``` UI/UX: Drop down. RED will be the default value flytectl: enforce the value to be limited to one of the enum values Signed-off-by: Ketan Umare <[email protected]> Signed-off-by: Haytham Abuelfutuh <[email protected]> Signed-off-by: wild-endeavor <[email protected]>
TL;DR
This PR introduces Enum Types in flytekit (flyteidl will natively support it)
Example usage:
UI/UX: Drop down. RED will be the default value
flytectl: enforce the value to be limited to one of the enum values
Signed-off-by: Ketan Umare [email protected]
Type
Are all requirements met?
Complete description
Design Doc
Tracking Issue
flyteorg/flyte#590