uv sync --lockeduv run pre-commit installuv run --frozen ruff check .
uv run --frozen ruff format .
uv run --frozen mypy langfuse --no-error-summaryFor a broad local confidence check, run:
bash scripts/codex/quick-check.shUnit tests do not require a running Langfuse server:
uv run --frozen pytest -n auto --dist worksteal tests/unitE2E tests require a running Langfuse server and environment variables based on .env.template:
uv run --frozen pytest -n 4 --dist worksteal tests/e2e -m "not serial_e2e"
uv run --frozen pytest tests/e2e -m "serial_e2e"Live-provider tests make real provider calls and require provider API keys:
uv run --frozen pytest -n 4 --dist worksteal tests/live_provider -m "live_provider"Run a specific test with:
uv run --frozen pytest tests/unit/test_resource_manager.py::test_pause_signals_score_consumer_shutdownThis repository includes repo-owned Codex setup so agents can start from a reproducible environment.
Recommended Codex UI configuration:
-
Create a Codex cloud environment for this repository.
-
Set the setup script to:
bash scripts/codex/setup.sh
-
Set the maintenance script to:
bash scripts/codex/maintenance.sh
-
Keep agent internet access disabled by default, or allow only the domains required for the task.
-
Add secrets and environment variables in the Codex UI instead of committing them.
PR titles and commit messages must follow Conventional Commits:
type(scope): description
type: description
Common types include feat, fix, docs, style, refactor, perf, test, build, ci, chore, revert, and security.
Before opening a PR:
- Self-review the diff and use
code_review.mdfor the repo-specific checklist. - Keep changes focused and avoid unrelated refactors.
- Add or update tests for behavior changes.
- List the verification commands you ran in the PR description.
The generated API client in langfuse/api/ must not be hand-edited. Regenerate it from the upstream Fern/OpenAPI source.
Releases are automated via GitHub Actions using PyPI Trusted Publishing (OIDC).
To create a release:
- Go to Actions > Release Python SDK
- Click "Run workflow"
- Select the version bump type:
patch- Bug fixes (1.0.0 → 1.0.1)minor- New features (1.0.0 → 1.1.0)major- Breaking changes (1.0.0 → 2.0.0)prepatch,preminor, orpremajor- Pre-release versions (for example 1.0.0 → 1.0.1a1)
- For pre-releases, select the type:
alpha,beta, orrc - Click "Run workflow"
The workflow will automatically:
- Bump the version in
pyproject.toml - Build the package
- Publish to PyPI
- Create a git tag and GitHub release with auto-generated release notes
Note: The generated SDK reference is currently work in progress.
The SDK reference is generated via pdoc. The docs dependency group is installed on demand when you run the documentation commands.
To update the reference, run the following command:
uv run --group docs pdoc -o docs/ --docformat google --logo "https://langfuse.com/langfuse_logo.svg" langfuseTo run the reference locally, you can use the following command:
uv run --group docs pdoc --docformat google --logo "https://langfuse.com/langfuse_logo.svg" langfuseThanks to the PostHog team for the awesome work on posthog-python. This project is based on it as it was the best starting point to build an async Python SDK.