-
Notifications
You must be signed in to change notification settings - Fork 301
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
feat: Support pep604 union operator #2298
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #2298 +/- ##
==========================================
- Coverage 83.89% 83.46% -0.44%
==========================================
Files 342 324 -18
Lines 25483 24716 -767
Branches 3725 3516 -209
==========================================
- Hits 21380 20630 -750
+ Misses 3472 3452 -20
- Partials 631 634 +3 ☔ View full report in Codecov by Sentry. |
Signed-off-by: ggydush <[email protected]>
Signed-off-by: ggydush <[email protected]>
Signed-off-by: ggydush <[email protected]>
Signed-off-by: ggydush <[email protected]>
Signed-off-by: ggydush <[email protected]>
Signed-off-by: ggydush <[email protected]>
Signed-off-by: ggydush <[email protected]>
Signed-off-by: ggydush <[email protected]>
Signed-off-by: ggydush <[email protected]>
Signed-off-by: ggydush <[email protected]>
Signed-off-by: ggydush <[email protected]>
Signed-off-by: ggydush <[email protected]>
f5e7ca2
to
dff23cb
Compare
Signed-off-by: ggydush <[email protected]>
Signed-off-by: ggydush <[email protected]>
Signed-off-by: ggydush <[email protected]>
Signed-off-by: ggydush <[email protected]>
Signed-off-by: ggydush <[email protected]>
Signed-off-by: ggydush <[email protected]>
Signed-off-by: ggydush <[email protected]>
Signed-off-by: ggydush <[email protected]>
Signed-off-by: ggydush <[email protected]>
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.
Thank you so much! Many people are asking about this feature
Co-authored-by: Kevin Su <[email protected]>
Signed-off-by: ggydush <[email protected]>
Signed-off-by: ggydush <[email protected]>
Signed-off-by: ggydush <[email protected]>
Signed-off-by: ggydush <[email protected]>
Signed-off-by: ggydush <[email protected]>
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.
This is awesome!
Signed-off-by: ggydush <[email protected]>
Signed-off-by: ggydush <[email protected]>
* feat: Support pep604 union operator Signed-off-by: ggydush <[email protected]> * fix: check union early Signed-off-by: ggydush <[email protected]> * refactor: Change name to 604 Signed-off-by: ggydush <[email protected]> * fix lint Signed-off-by: ggydush <[email protected]> * fix: Fix duplicated code Signed-off-by: ggydush <[email protected]> * fix: Remove code for testing Signed-off-by: ggydush <[email protected]> * test: Add simple tests Signed-off-by: ggydush <[email protected]> * Add more tests Signed-off-by: ggydush <[email protected]> * fix: Fix names Signed-off-by: ggydush <[email protected]> * fix: Lint Signed-off-by: ggydush <[email protected]> * fix: Fix again Signed-off-by: ggydush <[email protected]> * fix: Fix default Signed-off-by: ggydush <[email protected]> * test: Add test for parameter and defaults Signed-off-by: ggydush <[email protected]> * fix: Fix code coverage by ignoring Signed-off-by: ggydush <[email protected]> * refactor: Use is_union_type Signed-off-by: ggydush <[email protected]> * fix import sort Signed-off-by: ggydush <[email protected]> * fix: cleanup Signed-off-by: ggydush <[email protected]> * fix: fix Signed-off-by: ggydush <[email protected]> * refactor: Clean it up Signed-off-by: ggydush <[email protected]> * fix: Fix lint Signed-off-by: ggydush <[email protected]> * fix: Fix pydantic plugin test failure Signed-off-by: ggydush <[email protected]> * Update flytekit/core/type_engine.py Co-authored-by: Kevin Su <[email protected]> * Address comment Signed-off-by: ggydush <[email protected]> * fix: Use UnionTransformer Signed-off-by: ggydush <[email protected]> * fix: Fix lint Signed-off-by: ggydush <[email protected]> * Skip tests with | syntax on < 3.10 Signed-off-by: ggydush <[email protected]> * fix: Fix test Signed-off-by: ggydush <[email protected]> * fix: More review comments Signed-off-by: ggydush <[email protected]> * fix: Fix lint Signed-off-by: ggydush <[email protected]> --------- Signed-off-by: ggydush <[email protected]> Co-authored-by: Kevin Su <[email protected]> Signed-off-by: Jan Fiedler <[email protected]>
Tracking issue
Closes flyteorg/flyte#4706
Why are the changes needed?
Python 3.10 introduced the ability to write union types using | rather than importing from typing (e.g., int | str instead of typing.Union[int, str]), and I believe this should be supported. See PEP 604.
What changes were proposed in this pull request?
How was this patch tested?
Added unit tests and registered a large code base with the updated Flytekit and tested a workflow on remote. Ran a small test locally on Python 3.8 too to ensure correct error is bubbled up:
Setup process
Screenshots
Check all the applicable boxes
Related PRs
Docs link