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
Add python 3.10 support #2885
Add python 3.10 support #2885
Conversation
Error with 3.10 > DeprecationWarning: accessing one member from another is not supported
error with python 3.10 > DeprecationWarning: The distutils package is deprecated and slated > for removal in Python 3.12. > Use setuptools or check PEP 632 for potential alternatives
`|` operator has origin `types.Union` (and not `typing.Union`)
change from basic `__init__` to `test_hashable_required.<locals>.MyDataclass.__init__()` (with `__qualname__`)
With python 3.10, calling it results in > DeprecationWarning: There is no current event loop
For now it can not be compiled. Let's just skip the check on linux for now instead of tuning the CI pipeline
efad94a
to
358ded3
Compare
Hey @samuelcolvin
Reading this PR commit by commit should be trivial. The main thing is that I extracted |
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 looks great, pretty much ready to merge.
Can you just confirm what's changed in config.py
vs. main.py
?
Thanks so much. Sorry for the slow responses. New baby, new job, no sleep, no open source for a little while. |
Just to add enum repr related changes were reverted in Python 3.10 after discussion : https://mail.python.org/archives/list/python-dev@python.org/thread/ZMC67QA2JVQJSWSFWRS6IM6ZX4EK277G/#LSTMFAPSPD3BGZ4D6HQFODXZVB3PLYKF |
Congrats @samuelcolvin for the baby I didnt' know! Update: done in #3000 |
Add python 3.10 support (pydantic#2885)
import types | ||
|
||
def is_union(tp: Type[Any]) -> bool: | ||
return tp is Union or tp is types.Union |
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.
Is this a typo? shouldn't types.Union
be types.UnionType
?
https://docs.python.org/3.10/library/types.html#types.UnionType
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.
They changed between last beta and first RC.
#3085
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.
Thanks, hope this could be merged soon.
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.
I will soon. But it will be part of v1.9 most likely
Adding python 3.10 was mostly for CI and to ensure it will still work once out.
But I don't expect people to use 3.10 for production already since it is not stable yet
|
||
@pytest.mark.skipif(sys.version_info < (3, 10), reason='need 3.10 version') | ||
def test_new_union_origin(): | ||
"""On 3.10+, origin of `int | str` is `types.Union`, not `typing.Union`""" |
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.
Same here
@samuelcolvin when will this be released? |
Hopefully soon. I have a lot on at the moment. |
commenting here looking for advice from those familiar with the py3.10 changes. We recently had to upgrade from We use pydantic for all serialization & deserialization for my question is - any advice on common edge cases we should be aware of or add testing for, to (attempt to) verify this pair of versions will not bite us? I've read the linked issues and I don't believe they affect our specific use of |
Best way to speedup a resolution and the release of 1.9.1 world be if you could submit a bugfix for #3896. Otherwise I'll look at it soon. |
You may have struck some fear into my heart with your comment on #3896 :)
If you take an initial look, and it's something suited for a new contributor, I might be able to dig in. A deep dive is not in the cards for me at this movement, unfortunately. Thank you for your replies, pydantic has long been a very helpful library. |
Change Summary
Python 3.10.0b2 is out. Maintainers are invited to try it out. I reckon adding it in the CI doesn't hurt!
ℹ️ I invite you to read this commit by commit, which should make the review trivial
Related issue number
closes #2607
closes #2786
closes #2787
Checklist
changes/<pull request or issue id>-<github username>.md
file added describing change(see changes/README.md for details)