Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
iscoroutinefunctioninasynciois deprecated and it should be imported frominspectinstead. In python 3.14, this the use of this function raises deprecation warnings. The function was added toinspectin python 3.5 so this change should be backwards compatible with previous python versions.Important
Replace deprecated
asyncio.iscoroutinefunctionwithinspect.iscoroutinefunctioninlangfuse/_client/observe.pyfor Python 3.14 compatibility.asyncio.iscoroutinefunctionwithinspect.iscoroutinefunctionindecorator()inlangfuse/_client/observe.pyto avoid deprecation warnings in Python 3.14.This description was created by
for bd0adbb. You can customize this summary. It will automatically update as commits are pushed.
Disclaimer: Experimental PR review
Greptile Summary
This PR replaces the deprecated
asyncio.iscoroutinefunctionwithinspect.iscoroutinefunctionin the decorator dispatch logic ofLangfuseDecorator. The change is correct and forward-compatible —inspect.iscoroutinefunctionhas been available since Python 3.5, andinspectis already imported at the top of the module. Theasyncioimport is preserved because it is still needed forasyncio.create_taskelsewhere in the file.langfuse/_client/observe.py(line 198):asyncio.iscoroutinefunction(func)→inspect.iscoroutinefunction(func)inspectis already imported at line 3;asyncioremains necessary for other usagesinspect.iscoroutinefunctionis available since Python 3.5, covering all supported versionsasyncio.iscoroutinefunctionConfidence Score: 5/5
asyncioimport is correctly kept because it is still used elsewhere in the file. There are no logic, safety, or compatibility concerns. The change is backwards compatible with Python 3.5+.Flowchart
%%{init: {'theme': 'neutral'}}%% flowchart TD A["observe() decorator called with func"] --> B{"inspect.iscoroutinefunction(func)?"} B -- "True (async func)" --> C["self._async_observe(func, ...)"] B -- "False (sync func)" --> D["self._sync_observe(func, ...)"] C --> E["Returns async-wrapped decorator"] D --> F["Returns sync-wrapped decorator"]Last reviewed commit: bd0adbb
(3/5) Reply to the agent's comments like "Can you suggest a fix for this @greptileai?" or ask follow-up questions!