5a558eb09e
Backend Tests / discover-tests (push) Waiting to run
Backend Tests / ${{ matrix.name }} (push) Blocked by required conditions
Build and Publish SDK / build-and-publish (push) Waiting to run
Build Opik Docker Images / set-version (push) Waiting to run
Build Opik Docker Images / build-backend (push) Blocked by required conditions
Build Opik Docker Images / build-sandbox-executor-python (push) Blocked by required conditions
Build Opik Docker Images / build-python-backend (push) Blocked by required conditions
Build Opik Docker Images / build-frontend (push) Blocked by required conditions
Build Opik Docker Images / create-git-tag (push) Blocked by required conditions
ClickHouse Migration Cluster Check / validate-clickhouse-migrations (push) Waiting to run
Docs - Publish / run (push) Waiting to run
E2E Tests - Post Merge (v2) / 🧪 E2E v2 Tests (${{ github.event.inputs.tier || 't1' }}) (push) Waiting to run
E2E Tests - Post Merge (v2) / 📢 Slack Notification (push) Blocked by required conditions
Frontend Unit Tests / Test on Node 20 (push) Waiting to run
Guardrails E2E Tests / Select Python version matrix (push) Waiting to run
Guardrails E2E Tests / Guardrails E2E Tests ${{matrix.python_version}} (push) Blocked by required conditions
Guardrails E2E Tests / 📢 Slack Notification (push) Blocked by required conditions
Guardrails Backend Unit Tests / Guardrails Backend Unit Tests (push) Waiting to run
Guardrails Backend Unit Tests / 📢 Slack Notification (push) Blocked by required conditions
Lint Opik Helm Chart / lint-helm-chart (Helm v3.21.0) (push) Waiting to run
Lint Opik Helm Chart / lint-helm-chart (Helm v4.2.0) (push) Waiting to run
Lint Opik Helm Chart / unittest-helm-chart (push) Waiting to run
Lint Opik Helm Chart / render-equality (push) Waiting to run
Opik Optimizer - Unit Tests / Opik Optimizer Unit Tests Python ${{matrix.python_version}} (push) Waiting to run
Python BE E2E Tests / Python BE E2E (push) Waiting to run
Python Backend Tests / run-python-backend-tests (push) Waiting to run
Python SDK Unit Tests / Python SDK Unit Tests ${{matrix.python_version}} (push) Waiting to run
Release Drafter / update_release_draft (push) Waiting to run
SDK E2E Libraries Integration Tests / Check Secrets (push) Waiting to run
SDK E2E Libraries Integration Tests / Missed OpenAI API Key Warning (push) Blocked by required conditions
SDK E2E Libraries Integration Tests / build-opik (push) Blocked by required conditions
SDK E2E Libraries Integration Tests / E2E Lib Integration Python ${{matrix.python_version}} (push) Blocked by required conditions
TypeScript SDK Integration Build & Publish / build-and-publish (opik-gemini) (push) Waiting to run
TypeScript SDK Integration Build & Publish / build-and-publish (opik-langchain) (push) Waiting to run
TypeScript SDK Integration Build & Publish / build-and-publish (opik-openai) (push) Waiting to run
TypeScript SDK Integration Build & Publish / build-and-publish (opik-otel) (push) Waiting to run
TypeScript SDK Integration Build & Publish / build-and-publish (opik-vercel) (push) Waiting to run
TypeScript SDK Build & Publish / build-and-publish (push) Waiting to run
TypeScript SDK Unit Tests / Test on Node ${{ matrix.node-version }} (push) Waiting to run
TypeScript SDK Compatibility V1.x E2E Tests / Select Node version matrix (push) Has been cancelled
TypeScript SDK Compatibility V1.x E2E Tests / TypeScript SDK Compatibility V1.x E2E Tests Node ${{matrix.node_version}} (push) Has been cancelled
TypeScript SDK E2E Tests / TypeScript SDK E2E Tests Node ${{matrix.node_version}} (push) Has been cancelled
Opik Optimizer - E2E Tests / build-opik (push) Has been cancelled
TypeScript SDK Compatibility V1.x E2E Tests / build-opik (push) Has been cancelled
Python SDK E2E Tests / Select Python version matrix (push) Has been cancelled
Python SDK E2E Tests / Python SDK E2E Tests ${{matrix.python_version}} (push) Has been cancelled
Python SDK E2E Tests / build-opik (push) Has been cancelled
Python SDK Compatibility V1.x E2E Tests / Select Python version matrix (push) Has been cancelled
Python SDK Compatibility V1.x E2E Tests / Python SDK Compatibility V1.x E2E Tests ${{matrix.python_version}} (push) Has been cancelled
Python SDK Compatibility V1.x E2E Tests / build-opik (push) Has been cancelled
TypeScript SDK E2E Tests / Select Node version matrix (push) Has been cancelled
TypeScript SDK E2E Tests / build-opik (push) Has been cancelled
Opik Optimizer - E2E Tests / Opik Optimizer E2E Tests Python ${{matrix.python_version}} (push) Has been cancelled
Opik Optimizer - E2E Tests / Opik Optimizer Integration Smoke Tests (push) Has been cancelled
🐙 Code Quality / detect (push) Has been cancelled
🐙 Code Quality / lint (${{ matrix.leg.name }}) (push) Has been cancelled
🐙 Code Quality / summary (push) Has been cancelled
TypeScript SDK Library Integration Tests / Check Secrets (push) Has been cancelled
TypeScript SDK Library Integration Tests / opik-vercel (Vercel AI SDK / eve) (push) Has been cancelled
SDK Library Integration Tests Runner / Check Secrets (push) Has been cancelled
SDK Library Integration Tests Runner / Missed OpenAI API Key Warning (push) Has been cancelled
SDK Library Integration Tests Runner / Build (push) Has been cancelled
SDK Library Integration Tests Runner / openai_tests (push) Has been cancelled
SDK Library Integration Tests Runner / langchain_tests (push) Has been cancelled
SDK Library Integration Tests Runner / langchain_legacy_tests (push) Has been cancelled
SDK Library Integration Tests Runner / llama_index_tests (push) Has been cancelled
SDK Library Integration Tests Runner / anthropic_tests (push) Has been cancelled
SDK Library Integration Tests Runner / mistral_tests (push) Has been cancelled
SDK Library Integration Tests Runner / groq_tests (push) Has been cancelled
SDK Library Integration Tests Runner / aisuite_tests (push) Has been cancelled
SDK Library Integration Tests Runner / haystack_tests (push) Has been cancelled
SDK Library Integration Tests Runner / dspy_tests (push) Has been cancelled
SDK Library Integration Tests Runner / crewai_v0_tests (push) Has been cancelled
SDK Library Integration Tests Runner / crewai_v1_tests (push) Has been cancelled
SDK Library Integration Tests Runner / genai_tests (push) Has been cancelled
SDK Library Integration Tests Runner / adk_tests (push) Has been cancelled
SDK Library Integration Tests Runner / adk_legacy_1_3_0_tests (push) Has been cancelled
SDK Library Integration Tests Runner / evaluation_metrics_tests (push) Has been cancelled
SDK Library Integration Tests Runner / bedrock_tests (push) Has been cancelled
SDK Library Integration Tests Runner / litellm_tests (push) Has been cancelled
SDK Library Integration Tests Runner / harbor_tests (push) Has been cancelled
SDK Library Integration Tests Runner / Slack Notification (push) Has been cancelled
6.2 KiB
6.2 KiB
Repository Guidelines
Scope & Inheritance
- This file contains Python SDK specifics only.
- Follow
../../AGENTS.mdfor shared monorepo workflow, PR, and security policy.
Project Structure & Module Organization
This SDK lives under sdks/python.
src/opik/: Python package source.tests/: test suite, organized intounit/,integration/,e2e/,e2e_library_integration/, ande2e_smoke/.examples/: runnable integration examples and recipes.design/andoutputs/: design assets and generated artifacts.README.md: SDK overview and contributor entry points.
Build, Test, and Development Commands
See also ../../AGENTS.md#build-test-and-development-commands for full monorepo commands.
Run commands from sdks/python unless noted.
pip install -r tests/test_requirements.txt && pytest tests/unit tests/integration tests/e2e: install test dependencies and run standard tests.pytest tests/e2e_library_integration tests/e2e_smoke: run higher-cost integration coverage.cd "$(git rev-parse --show-toplevel)" && make precommit: run formatting, linting, and mypy hooks on changed files (vs origin/main) via the root pre-commit config.opik configure --use_local(oropik configure): local SDK configuration for local/dev environments.
Coding Style & Naming Conventions
- Python target matches the module’s supported versions in
pyproject.toml(currently 3.10+) with 4-space indentation and line length 88. - Primary style tooling:
ruffandruff format(configured in.ruff.toml) plusmypy(via pre-commit). - Prefer explicit names, avoid abbreviations; avoid
utils.py/helpers.pystyle catch-alls. - Prefer module-style imports over single-name imports in new code.
- Keep names private with
_prefix only when not used outside the module. - Keep comments focused on intent (“why”), not mechanics (“what”).
Testing Guidelines
- Prefer unit tests (
tests/unit) for behavior changes. - Add integration tests when touching backend or integration behavior, and e2e tests for cross-system flows.
- Use existing fixture patterns in
tests/unitandtests/library_integration. - Run focused suites before PR submission; avoid relying only on broad e2e runs when unit tests suffice.
- File naming:
test_*.pyundertests/<category>/.
E2E test isolation contract (tests/e2e/)
The e2e suite runs under pytest-xdist with --dist=loadfile: each test file is dispatched to one worker, and multiple files run in parallel against a shared backend. Resource names must therefore not collide across files.
- Backend project name for a test module comes from
generate_project_name("e2e", __name__)(helper intests/testlib/project_naming.py, re-exported fromtests.testlib). Files that need to reference the project (verifier fallback,search_traces, etc.) declare at module top:Referencefrom ..testlib import generate_project_name PROJECT_NAME = generate_project_name("e2e", __name__)PROJECT_NAMEdirectly in test bodies — do not introduce aproject_name = PROJECT_NAMEindirection. The autouseconfigure_e2e_tests_envfixture readsPROJECT_NAMEfrom each test module and patchesOPIK_PROJECT_NAME, so the constant is the single source of truth. Files that don't reference the project name in Python don't need to declare anything; the fixture falls back to deriving a name from the module. - Alternative projects — used to exercise the
project_name=override path — must not embedgenerate_project_name(...)as a@pytest.mark.parametrizedecorator value. Every worker collects every parametrize id, and xdist's collection-consistency check fails when ids differ across workers;generate_project_namereturns a different value per process. Parametrize on a boolean and compute the project name inside the test body:Each CI job has its own backend stack, and@pytest.mark.parametrize("override_project_name", [True, False]) def test_xxx(opik_client, override_project_name): project_name = ( generate_project_name("e2e", "anonymization", "override") if override_project_name else None ) ...--dist=loadfilekeeps each file on a single worker, so different workers computing different names is not a collision risk in practice. - Per-test resources — datasets, experiments, prompts, temporary projects — already use unique names via the
dataset_name,experiment_name,prompt_name,temporary_project_namefixtures. Use them; do not invent your own per-test name. - No raw
random_chars()calls for project names. Reach for it directly only when you need a non-project resource name and there is no fixture for it. - No bare hardcoded literals for project / dataset / experiment / prompt / suite / annotation-queue / optimization names anywhere under
tests/e2e/**. Strings derived from a unique-per-test fixture (e.g.f"test_optimization_{dataset_name}") are fine —dataset_namealready injects a random suffix. configure_e2e_tests_envis autouse and module-scoped. Do not narrow it; teardown ordering under xdist will surface narrower scopes as flake.- xdist + classes: with
--dist=loadfiletest classes are not split across workers — every test in a file (including those insideclass Test…) runs on the same worker. Module-level constants and module-scoped fixtures span both module-level and class-level tests in that file. If you switch a file to--dist=loadscope, revisit the scope contract.
If you find a hardcoded resource name during code review, treat it as a defect on the same severity as a missing teardown.
Agent Contribution Workflow
- This module is part of the Opik monorepo; follow the shared workflow in
../../AGENTS.md#agent-contribution-workflow. - Run relevant formatter and test commands in this file for Python SDK changes before requesting review.
Commit & Pull Request Guidelines
- Follow shared commit/PR policy in
../../AGENTS.md. - Python SDK-specific convention: use SDK-prefixed titles (for example
[OPIK-####] [SDK] ...) when applicable.
Security & Configuration Tips
- Follow shared security policy in
../../AGENTS.md. - Python SDK-specific rule: configure credentials via
opik configure/environment variables, never hardcode them.