-
-
Notifications
You must be signed in to change notification settings - Fork 139
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
Workaround for pydantic v2 #288
Conversation
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.
Fantastic! 🙌 Thank you for figuring this out!
I like this approach because it is agnostic which version our library users require for other parts of their project. Also, since it does not require changing any of our APIs or behaviors, we can make it a patch release instead of a minor version bump.
I suggested a couple changes below. I also think we could add a few lines to tox.ini
to ensure that our test suite runs successfully against both major versions of pydantic:
diff --git a/tox.ini b/tox.ini
index 584ae4d..142db2e 100644
--- a/tox.ini
+++ b/tox.ini
@@ -3,6 +3,7 @@ envlist =
pre-commit
mypy
py3{8,9,10,11}-requests{min,max}
+ py3{8,9,10,11}-pydantic1
coverage
[gh-actions]
@@ -29,6 +30,7 @@ deps =
-r requirements-test.txt
requestsmin: requests==2.22.0 # Keep in sync with setup.cfg
requestsmax: requests>=2.22.0 # Keep in sync with setup.cfg
+ pydantic1: pydantic<2 # Lots of projects still use 1.x
[testenv:coverage]
passenv = COVERAGE_FORMAT
I'll be very happy to merge this branch once we've got test coverage and have at least tried those other ideas.
Codecov Report
@@ Coverage Diff @@
## main #288 +/- ##
==========================================
- Coverage 95.80% 95.51% -0.29%
==========================================
Files 19 20 +1
Lines 929 937 +8
==========================================
+ Hits 890 895 +5
- Misses 39 42 +3
|
Agree re tox, I'll add it later today. |
35914b4
to
d80b1f3
Compare
@mesozoic I updated the PR to
|
@mesozoic , any idea what's up with the docs failing? |
I think you might've forgotten to |
d80b1f3
to
aa501ec
Compare
@mesozoic , heh, my bad. Ok, renamed it to _compat.py. |
@xl0 One more request, could you rebase the branch with signed commits? Easiest way is with SSH, in my experience, but the repo requires it before we merge. I could rebase and merge it on your behalf, but then you won't get any credit. 😁 |
Ok, I'll check it later today. |
aa501ec
to
762b1bc
Compare
@mesozoic , done |
Thanks very much for solving this! |
It's a bit heavier than expected to make mypy happy on both pydantic versions.