From c0292ec7cceb15730ef1f110ca0652966db2c48b Mon Sep 17 00:00:00 2001 From: Hassieb Pakzad <68423100+hassiebp@users.noreply.github.com> Date: Tue, 5 Aug 2025 11:40:24 +0200 Subject: [PATCH 1/2] fix(client): parse env vars for debug and tracing enabled case insensitive --- langfuse/_client/client.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/langfuse/_client/client.py b/langfuse/_client/client.py index 0f80f1816..d205e5d51 100644 --- a/langfuse/_client/client.py +++ b/langfuse/_client/client.py @@ -187,14 +187,16 @@ def __init__( self._tracing_enabled = ( tracing_enabled - and os.environ.get(LANGFUSE_TRACING_ENABLED, "True") != "False" + and os.environ.get(LANGFUSE_TRACING_ENABLED, "true").lower() != "false" ) if not self._tracing_enabled: langfuse_logger.info( "Configuration: Langfuse tracing is explicitly disabled. No data will be sent to the Langfuse API." ) - debug = debug if debug else (os.getenv(LANGFUSE_DEBUG, "False") == "True") + debug = ( + debug if debug else (os.getenv(LANGFUSE_DEBUG, "false").lower() == "true") + ) if debug: logging.basicConfig( format="%(asctime)s - %(name)s - %(levelname)s - %(message)s" From bc6183d29467db6cb28d869bff5711fd1c27a842 Mon Sep 17 00:00:00 2001 From: Hassieb Pakzad <68423100+hassiebp@users.noreply.github.com> Date: Tue, 5 Aug 2025 13:16:14 +0200 Subject: [PATCH 2/2] push --- langfuse/__init__.py | 4 ++-- tests/test_otel.py | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/langfuse/__init__.py b/langfuse/__init__.py index a61325071..5d8da4cc2 100644 --- a/langfuse/__init__.py +++ b/langfuse/__init__.py @@ -1,12 +1,12 @@ """.. include:: ../README.md""" +from ._client import client as _client_module from ._client.attributes import LangfuseOtelSpanAttributes from ._client.get_client import get_client -from ._client import client as _client from ._client.observe import observe from ._client.span import LangfuseEvent, LangfuseGeneration, LangfuseSpan -Langfuse = _client.Langfuse +Langfuse = _client_module.Langfuse __all__ = [ "Langfuse", diff --git a/tests/test_otel.py b/tests/test_otel.py index 3e52b10fc..dfa298161 100644 --- a/tests/test_otel.py +++ b/tests/test_otel.py @@ -95,7 +95,8 @@ def mock_init(self, **kwargs): ) monkeypatch.setattr( - "langfuse._client.span_processor.LangfuseSpanProcessor.__init__", mock_init + "langfuse._client.span_processor.LangfuseSpanProcessor.__init__", + mock_init, ) @pytest.fixture