Skip to content
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

🐛 Fix support for UnionType with Python 3.11 #676

Closed
wants to merge 3 commits into from

Conversation

standag
Copy link

@standag standag commented Oct 3, 2023

Resolves #533

@thomasaarholt
Copy link

This worked like a charm! Thank you!

@adam-moss
Copy link

This is a very nice addition 👍

@coreegor
Copy link

Hello everyone,
Is there any plan on having this merged ?
@standag can you set an assignee ?

@standag
Copy link
Author

standag commented Oct 16, 2023

Sorry, I cannot, I haven't write access to this repository.

@peidrao
Copy link

peidrao commented Oct 18, 2023

The PR seems wonderful, why hasn't it been added yet?

@coreegor
Copy link

@standag So you can't set @tiangolo as the assignee ?

@standag
Copy link
Author

standag commented Oct 26, 2023

Who can use this feature
Anyone with write access to a repository can assign issues and pull requests.
https://docs.github.com/en/issues/tracking-your-work-with-issues/assigning-issues-and-pull-requests-to-other-github-users

@disrupted
Copy link

also resolves #348

@aronbierbaum
Copy link

Are there any updates on this pull request. Would love to not need to use Optional or Union.

@johnthagen johnthagen mentioned this pull request Jan 16, 2024
7 tasks
@tino
Copy link

tino commented Jan 26, 2024

@disrupted is @tiangolo the only one that can merge? Seems a bit wasteful that this is sitting here with 2 approves and a passing CI just waiting.

@disrupted
Copy link

@disrupted is @tiangolo the only one that can merge? Seems a bit wasteful that this is sitting here with 2 approves and a passing CI just waiting.

Looks like it. My review only has symbolic value as I am not a maintainer.

@svlandeg
Copy link
Member

Related PR: #548

@sebastian-correa
Copy link

Will this be merged anytime soon? @tiangolo

This has become a sore point with Typer in our code.

@svlandeg svlandeg added bug Something isn't working and removed p3 labels Apr 11, 2024
@svlandeg svlandeg added p2 and removed feature New feature, enhancement or request labels Apr 11, 2024
@svlandeg svlandeg changed the title fix: add support for UnionType annotation 🐛 Fix support for UnionType with Python 3.11 Apr 11, 2024
Copy link
Member

@svlandeg svlandeg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I confirmed that this behaviour works in 3.10 but broke in 3.11, and the unit test introduced in this PR captures the bug nicely.

The fix is very clean and minimal, using the variables from _typing that were introduced precisely for this type of usage.

Thanks for the contribution @standag!

@svlandeg
Copy link
Member

svlandeg commented Apr 11, 2024

Update: #548 now contains all the changes that are also in this PR, as well as a few additional rewrites. As such, I recommend to merge #548 and close this one, but I'll leave the final decision with Tiangolo.

@svlandeg svlandeg linked an issue Apr 11, 2024 that may be closed by this pull request
7 tasks
@svlandeg svlandeg linked an issue Apr 11, 2024 that may be closed by this pull request
7 tasks
@johnthagen johnthagen mentioned this pull request May 2, 2024
3 tasks
Copy link

@ml31415 ml31415 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. Please merge.

@ml31415
Copy link

ml31415 commented May 29, 2024

Dear Sebastian @tiangolo ,
please consider adding one or two trusted persons as maintainers for this package. Python 3.13 is about to come out and this issue for py3.11 is still not fixed, despite long time opened pull requests. I have full understanding for being busy or losing interest in maintenance for a package after a while. But the community is here to help out, to keep this package going. Please just let the community do it's job!

@tiangolo
Copy link
Member

Thank you for the work @standag! ☕

And thanks @svlandeg for all the help 🙇

This should have been fixed by #548

It is now available in Typer 0.12.4 🚀

Given that, I'll close this one.

@tiangolo tiangolo closed this Aug 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working p2 types Type hints and type checking
Projects
None yet