-
Notifications
You must be signed in to change notification settings - Fork 253
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
Improve mypy typing performance #387
Conversation
CI issues seems to be related to cargo. The branch probably needs to be changed to just Line 30 in bfb373c
Line 71 in bfb373c
|
See also python/mypy#14034. V0.18.1 of pyo3 was released late last night, so we need to.update cargo. But the bigger question is: does this worth |
Codecov Report
📣 This organization is not using Codecov’s GitHub App Integration. We recommend you install it so Codecov can continue to function properly for your repositories. Learn more Additional details and impacted files@@ Coverage Diff @@
## main #387 +/- ##
=======================================
Coverage 95.31% 95.31%
=======================================
Files 90 90
Lines 10510 10512 +2
Branches 8 8
=======================================
+ Hits 10018 10020 +2
Misses 492 492
Continue to review full report at Codecov.
|
CodSpeed Performance ReportMerging #387 Summary
|
Seems like this won't type check, unfortunately 😕 |
Ref: python/mypy#14627
Trying to run mypy with pydantic
2.0.0.dev.0
hangs when trying to lintThe likely reason for that is the
CoreSchema
type. Mypy can't handle unions with a lot of items that well. Especially for TypedDicts, it tries to find a common base type but when there is none, checks the compatibility of each keys individually.That's even more of an issue as there are also some recursive annotations with
CoreSchema
.pydantic-core/pydantic_core/core_schema.py
Lines 2547 to 2588 in bfb373c
pydantic-core/pydantic_core/core_schema.py
Lines 1724 to 1726 in bfb373c
To improve mypy performance, I added an empty
CoreSchemaBase
TypedDict type from which allCoreSchema
types can inherit and replaced the recursiveCoreSchema
types. With that a mypy run is back down to 15-20s.