You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Basically, I use TypeAdapter(Annotated[...]).validate_python in my custom validators quite ofter, but now after pydantic began to actually follow the PEPs, following examples no longer pass the type checker.
It is a "problem" with pydantic types that as far as I know does not have a real solution until Python makes changes to it's typing system to offer one. And it wasn't a problem until (necessary, correct) breaking changes were made to Python typing that were outside of Pydantic's control.
In the meantime, we relaxed our typing to Any so you won't get a type error as of the next release #8923. But you also won't get any useful typing.
Also, and unrelated, I highly recommend you don't create TypeAdapter instances dynamically. Create them as global constants and reference them from within your lambda functions.
Initial Checks
Description
See https://discuss.python.org/t/is-annotated-compatible-with-type-t/43898, microsoft/pyright#7091, https://github.com/python/typing/pull/1618/files.
Basically, I use
TypeAdapter(Annotated[...]).validate_python
in my custom validators quite ofter, but now after pydantic began to actually follow the PEPs, following examples no longer pass the type checker.I have submitted this issue because Jelle Zijlstra explicitly said that this is a problem with pydantic types: https://discuss.python.org/t/is-annotated-compatible-with-type-t/43898/24
Example Code
Python, Pydantic & OS Version
The text was updated successfully, but these errors were encountered: