You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -4,115 +4,175 @@ This file provides guidance to Claude Code (claude.ai/code) when working with co
4
4
5
5
## Project Overview
6
6
7
-
This is the Langfuse Python SDK, a client library for accessing the Langfuse observability platform. The SDK provides integration with OpenTelemetry (OTel) for tracing, automatic instrumentation for popular LLM frameworks (OpenAI, Langchain, etc.), and direct API access to Langfuse's features.
7
+
This is the **Langfuse Python SDK**, an observability and analytics platform for AI applications. It provides tracing, evaluation, and analytics for LLM applications through multiple interfaces: decorators, low-level SDK, and integrations with popular AI libraries.
8
8
9
9
## Development Commands
10
10
11
-
### Setup
11
+
### Environment Setup
12
12
```bash
13
-
# Install Poetry plugins (one-time setup)
14
-
poetry self add poetry-dotenv-plugin
15
-
poetry self add poetry-bumpversion
13
+
# Using UV (preferred)
14
+
uv venv --python 3.12
15
+
source .venv/bin/activate
16
+
uv sync
16
17
17
-
#Install all dependencies including optional extras
18
+
#Using Poetry (legacy)
18
19
poetry install --all-extras
19
-
20
-
# Setup pre-commit hooks
21
20
poetry run pre-commit install
22
21
```
23
22
24
23
### Testing
25
24
```bash
26
-
# Run all tests with verbose output
25
+
# Run all tests
27
26
poetry run pytest -s -v --log-cli-level=INFO
28
27
29
-
# Run a specific test
28
+
# Run specific test
30
29
poetry run pytest -s -v --log-cli-level=INFO tests/test_core_sdk.py::test_flush
31
30
32
-
# Run tests in parallel (faster)
33
-
poetry run pytest -s -v --log-cli-level=INFO -n auto
31
+
# Run with UV
32
+
uv run pytest -s -v --log-cli-level=INFO
34
33
```
35
34
35
+
### Memory for Running Unit Tests
36
+
- To run unit tests you must always use the env file, use: `UV_ENV_FILE=.env uv run pytest -s -v --log-cli-level=INFO tests/TESTFILE::TEST_NAME`
37
+
36
38
### Code Quality
37
39
```bash
38
-
# Format code with Ruff
39
-
poetry run ruff format .
40
-
41
-
# Run linting (development config)
42
-
poetry run ruff check .
40
+
# Format code
41
+
ruff format .
43
42
44
-
# Run type checking
45
-
poetry run mypy.
43
+
# Run linter (development config)
44
+
ruff check.
46
45
47
-
# Run pre-commit hooks manually
48
-
poetry run pre-commit run --all-files
46
+
# Run linter (CI config)
47
+
ruff check --config ci.ruff.toml .
49
48
```
50
49
51
-
### Building and Releasing
50
+
### Documentation
52
51
```bash
53
-
# Build the package
54
-
poetry build
55
-
56
-
# Run release script (handles versioning, building, tagging, and publishing)
57
-
poetry run release
58
-
59
-
# Generate documentation
52
+
# Generate SDK reference docs
60
53
poetry run pdoc -o docs/ --docformat google --logo "https://langfuse.com/langfuse_logo.svg" langfuse
54
+
55
+
# Serve docs locally
56
+
poetry run pdoc --docformat google --logo "https://langfuse.com/langfuse_logo.svg" langfuse
61
57
```
62
58
63
-
## Architecture
59
+
## Architecture Overview
64
60
65
61
### Core Components
66
62
67
-
-**`langfuse/_client/`**: Main SDK implementation built on OpenTelemetry
68
-
-`client.py`: Core Langfuse client with OTel integration
0 commit comments