chore: Bump mypy version to 1.20 in core, langchain_v1, text-splitters and standard-tests#36470
chore: Bump mypy version to 1.20 in core, langchain_v1, text-splitters and standard-tests#36470Christophe Bornet (cbornet) wants to merge 1 commit intolangchain-ai:masterfrom
Conversation
Merging this PR will not alter performance
Performance Changes
Comparing Footnotes |
|
I think a more compelling change here would be switching from mypy to ty, FWIW |
4cb38d9 to
9e23be4
Compare
Happy to switch to ty too!
|
| if ignore_condition_name is None or not getattr(handler, ignore_condition_name): | ||
| event = getattr(handler, event_name) | ||
| if asyncio.iscoroutinefunction(event): | ||
| if inspect.iscoroutinefunction(event): |
There was a problem hiding this comment.
do we need inspect instead of asyncio for mypy version upgrade? otherwise, we are combining two different tasks into one PR, like upgrading mypy version, replacing asyncio with inspect
There was a problem hiding this comment.
Yes it’s needed by mypy upgrade. It comes from an update of typeshed in mypy.
There was a problem hiding this comment.
sounds good then!!. Thnx for clarification
There was a problem hiding this comment.
it will be nice to document that inspect is preferred way rather than asyncio for newer version of python. I was looking for source why inspect.iscoroutinefunction is better than asyncio.iscoroutinefunction, but this is what I could find. other than if mypy states that explicit that u need to use inspect over asyncio
Eitherway, I let u navigate this however u like
There was a problem hiding this comment.
Python 3.14 makes it clear at runtime that asyncio.iscoroutinefunction is deprecated
>>> import asyncio
>>> asyncio.iscoroutinefunction(int)
<python-input-1>:1: DeprecationWarning: 'asyncio.iscoroutinefunction' is deprecated and slated for removal in Python 3.16; use inspect.iscoroutinefunction() instead
FalseThe newest mypy just catched up to that.
I don't think it's needed to document that in LangChain itself. It would only be noise.
9e23be4 to
6cb4977
Compare
No description provided.