-
-
Notifications
You must be signed in to change notification settings - Fork 511
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
Implement unions as annotated types #2840
Implement unions as annotated types #2840
Conversation
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## main #2840 +/- ##
==========================================
- Coverage 96.37% 95.96% -0.41%
==========================================
Files 207 207
Lines 8957 9028 +71
Branches 1646 1662 +16
==========================================
+ Hits 8632 8664 +32
- Misses 206 238 +32
- Partials 119 126 +7 |
Thanks for adding the Here's a preview of the changelog: This release adds support for declaring union types using Code using the old syntax will continue to work, but it will trigger a Before: Animal = strawberry.union("Animal", (Cat, Dog)) After: from typing import Annotated, Union
Animal = Annotated[Union[Cat, Dog], strawberry.union("Animal")] Here's the preview release card for twitter: Here's the tweet text:
|
802dfbc
to
c7bf740
Compare
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! <3
I've left only one comment 😊
ebbb837
to
9e2ff64
Compare
* Replace click with typer * Fix dependencies * Fix type * Update test for pyinstrument * Lock * Use stdout instead of output * Add release notes * Workound failing tests * Fix one more test
…ql#2227) Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Matt Gilson <mgilson@lat.ai> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Patrick Arminio <patrick.arminio@gmail.com>
for more information, see https://pre-commit.ci
I've worked on this a bit more, I think it is almost ready to go, I want to improve the errors, but shouldn't take too long 😊 |
This should be ready now 😊 |
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.
My 2 cents :)
this is ready! |
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.
No more suggestions, LGTM 👍🏼
@bellini666 let's merge yours first and then this one later today or tomorrow 😊 |
Description
Replace
strawberry.union
direct usage withtyping.Annotated
for better type hintstests/types/resolving/test_unions.py
tests/types/resolving/test_unions.py
Types of Changes
Issues Fixed or Closed by This PR
Checklist