-
Notifications
You must be signed in to change notification settings - Fork 252
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
run stubtest on _pydantic_core.pyi #702
Conversation
please review |
Codecov Report
❗ Your organization is not using the GitHub App Integration. As a result you may experience degraded service beginning May 15th. Please install the Github App Integration for your organization. Read more. Additional details and impacted files@@ Coverage Diff @@
## main #702 +/- ##
=======================================
Coverage 93.73% 93.74%
=======================================
Files 99 99
Lines 13806 13821 +15
Branches 25 25
=======================================
+ Hits 12941 12956 +15
Misses 859 859
Partials 6 6
Continue to review full report in Codecov by Sentry.
|
CodSpeed Performance ReportMerging #702 Summary
Benchmarks breakdown
|
40b03e9
to
62ab58d
Compare
Lint error is annoying consequence of installed wheel not placing native module inside the source tree, I'll push a proposed fix. |
pydantic_core/_pydantic_core.pyi
Outdated
class PydanticSerializationError(ValueError): | ||
def __init__(self, message: str) -> None: ... | ||
|
||
@final | ||
class PydanticSerializationUnexpectedValue(ValueError): | ||
def __init__(self, message: 'str | None' = None) -> None: ... |
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.
Maybe we should make these __new__
since that's what's actually happening? Can be another PR but I'd be okay if you just do it here since you're correctifying things already.
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.
That's probably more correct, however I'd like to check how that influences mypy's handling of these types so I'll follow up in another PR.
4dceb7c
to
6b74b69
Compare
Rebased on #705, which should make CI green. |
6b74b69
to
07858a5
Compare
python/pydantic_core/__init__.py
Outdated
example_message_python: str | ||
message_template_json: _NotRequired[str] | ||
example_message_json: _NotRequired[str] | ||
example_context: 'dict[str, str | int | float] | None' |
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.
Any reason to not add from __future__ import annotations
?
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.
None, let's do that.
07858a5
to
ff6b5cb
Compare
Change Summary
This PR adds use of mypy's
stubtest
tool to validate the.pyi
file forpydantic-core
, and fixes the errors detected.Most of this is mechanical fixups which are good to have correct but not interesting to debate. The interesting things of note:
.mypy-stubtest-allowlist
.TypedDict
definitions topydantic_core/__init__.py
as these were reported at missing at runtime, and I think it's fair users may want to import these.@final
, because PyO3 types are final by default. We should review if we want to allow subtyping any of them.Related issue number
N/A
Checklist
pydantic-core
(except for expected changes)Selected Reviewer: @adriangb