Repository navigation
Conversation
|
|
This branch has not been deployed
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.
What does this PR do?
observe()(partial(fn, ...))raisesAttributeErrorbefore callingfn, because partial objects do not have a__name__. This affects both sync and async functions when no observation name is supplied.Resolve the default name from the wrapped function, including nested partials. Explicit observation names and a partial's own
__name__keep their precedence; the original partial is still used for execution and argument inspection.Adds six regression cases for sync/async partials, explicit names, and nested partials with or without a custom function name. Four fail on the current main branch.
Type of change
Verification
uv run --frozen pytest tests/unit/test_observe.py -q uv run --frozen ruff check . uv run --frozen ruff format --check langfuse/_client/observe.py tests/unit/test_observe.py uv run --frozen mypy langfuse --no-error-summaryAll 21 observe unit tests pass on Python 3.13. Lint, formatting, and type checks pass. E2E and live-provider tests were not run; these cases use the shared in-memory exporter and do not need a Langfuse server or provider calls.
Checklist
code_review.md..env.templateif needed (no changes needed).

Confidence Score: 5/5
This PR appears safe to merge.Summary
Fixes default observation names for partial functions in both sync and async calls.
No actionable issues found.
Reviews (1) · Last reviewed commit: "fix(observe): resolve names for partial ..." · Reviewed by Greptile