Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

janwinkler1
Copy link
Contributor

@janwinkler1 janwinkler1 commented Jul 29, 2025

Fixes langfuse/langfuse#8176

Pyright flags Langfuse import as private after py.typed was added.

Fix: explicitly re-export in init.py


Important

Re-export Langfuse in __init__.py to avoid Pyright flagging it as a private import.

  • Fix:
    • Re-export Langfuse in __init__.py to avoid Pyright flagging it as a private import.
  • Misc:
    • Addresses issue #8176 related to Pyright and py.typed.

This description was created by Ellipsis for 8c91957. You can customize this summary. It will automatically update as commits are pushed.

Disclaimer: Experimental PR review

Greptile Summary

This PR addresses a type checking issue with Pyright that arose after the package was marked as typed with py.typed. The change modifies how the Langfuse class is imported and re-exported in the package's __init__.py file.

What changed:

  • Instead of directly importing Langfuse from the private module ._client.client, the code now imports the entire client module as _client
  • The Langfuse class is then re-exported through an explicit attribute assignment: Langfuse = _client.Langfuse

Why this change was needed:
Pyright enforces that modules prefixed with underscores (like ._client.client) are private and should not be directly imported from outside the package. When py.typed was added to mark the package as typed, Pyright began flagging the direct import as accessing private internals.

How it fits with the codebase:
This change maintains the exact same public API - users can still import Langfuse from the package root as before. The __all__ list remains unchanged, ensuring the public interface is preserved. This is a common Python pattern for controlling what gets exposed as the public interface while keeping internal module structure private. The change only affects the import mechanism, not the functionality or runtime behavior.

Confidence score: 5/5

  • This is a safe cosmetic change that only affects import mechanics without altering functionality
  • The fix directly addresses the reported Pyright issue using a well-established Python pattern
  • No files need additional attention as this is a straightforward type checker compatibility fix

@CLAassistant
Copy link

CLAassistant commented Jul 29, 2025

CLA assistant check
All committers have signed the CLA.

Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1 file reviewed, no comments

Edit Code Review Bot Settings | Greptile

@hassiebp hassiebp self-requested a review July 29, 2025 08:10
@hassiebp
Copy link
Contributor

Thanks for your contribution @janwinkler1 !

@hassiebp hassiebp merged commit eba5f7f into langfuse:main Jul 29, 2025
1 check passed
@janwinkler1
Copy link
Contributor Author

@hassiebp, you're welcome!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

bug: pyright breaks in 3.2.1 - can't import Langfuse
3 participants