Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 0 additions & 8 deletions .github/workflows/checks.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -73,14 +73,6 @@ jobs:

langchain-py:
uses: ./.github/workflows/langchain-py-test.yaml
strategy:
fail-fast: false
matrix:
python-version: ["3.10", "3.11", "3.12", "3.13"]
os: [ubuntu-latest, windows-latest]
with:
python-version: ${{ matrix.python-version }}
os: ${{ matrix.os }}

upload-wheel:
needs: build
Expand Down
34 changes: 13 additions & 21 deletions .github/workflows/langchain-py-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,12 @@ name: langchain-py

on:
workflow_call:
inputs:
python-version:
required: true
type: string
os:
required: true
type: string

jobs:
test:
runs-on: ${{ inputs.os }}
runs-on: ubuntu-latest
timeout-minutes: 15

defaults:
run:
working-directory: integrations/langchain-py

steps:
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1

Expand All @@ -27,22 +16,25 @@ jobs:
with:
cache: true
experimental: true
install_args: python@${{ inputs.python-version }} uv
install_args: uv

- name: Install dependencies
working-directory: integrations/langchain-py
run: |
mise exec python@${{ inputs.python-version }} -- uv sync
mise exec -- uv sync

- name: Lint with ruff
if: ${{ inputs.os == 'ubuntu-latest' }}
- name: Lint package
working-directory: integrations/langchain-py
run: |
mise exec python@${{ inputs.python-version }} -- uv run ruff check $(git ls-files '*.py' | grep -v 'examples/')
mise exec -- uv run ruff check $(git ls-files '*.py' | grep -v 'examples/')

- name: Run tests
working-directory: integrations/langchain-py
run: |
mise exec python@${{ inputs.python-version }} -- uv run pytest src
mise exec -- uv run pytest src

- name: Test import
- name: Test package import
working-directory: integrations/langchain-py
run: |
mise exec python@${{ inputs.python-version }} -- uv run python -c "import braintrust_langchain; print('braintrust_langchain imported successfully')"
mise exec python@${{ inputs.python-version }} -- uv run python -c "from braintrust_langchain import BraintrustCallbackHandler; print('BraintrustCallbackHandler imported successfully')"
mise exec -- uv run python -c "import braintrust_langchain; print('braintrust_langchain imported successfully')"
mise exec -- uv run python -c "from braintrust_langchain import BraintrustCallbackHandler; print('BraintrustCallbackHandler imported successfully')"
3 changes: 3 additions & 0 deletions integrations/langchain-py/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,9 @@ members = [
".",
]

[tool.uv.sources]
braintrust = { path = "../../py", editable = true }

[dependency-groups]
dev = [
"build",
Expand Down
24 changes: 22 additions & 2 deletions integrations/langchain-py/src/braintrust_langchain/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,24 @@
from .callbacks import BraintrustCallbackHandler
from .context import set_global_handler
"""
DEPRECATED: braintrust-langchain is now part of the main braintrust package.

Install `braintrust` and use `from braintrust.integrations.langchain import BraintrustCallbackHandler` instead.
This package now re-exports from `braintrust.integrations.langchain` for backward compatibility.
"""

import warnings

warnings.warn(
"braintrust-langchain is deprecated. The LangChain integration is now included in the main "
"'braintrust' package. Use 'from braintrust.integrations.langchain import BraintrustCallbackHandler' "
"instead. This package will be removed in a future release.",
DeprecationWarning,
stacklevel=2,
)

# Re-export public API from the new location for backward compatibility
from braintrust.integrations.langchain import ( # noqa: E402, F401
BraintrustCallbackHandler,
set_global_handler,
)

__all__ = ["BraintrustCallbackHandler", "set_global_handler"]
3 changes: 1 addition & 2 deletions integrations/langchain-py/src/tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import os

import pytest
from braintrust.integrations.langchain.context import clear_global_handler
from braintrust.logger import (
TEST_API_KEY,
Logger,
Expand All @@ -11,8 +12,6 @@
)
from braintrust.test_helpers import init_test_logger

from braintrust_langchain.context import clear_global_handler


@pytest.fixture(autouse=True)
def setup_braintrust():
Expand Down
28 changes: 28 additions & 0 deletions integrations/langchain-py/src/tests/test_compat.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
"""Test that braintrust_langchain re-exports the public API from braintrust.integrations.langchain."""

import importlib
import warnings

import pytest


def test_public_api_reexported():
"""All public API symbols should be importable from braintrust_langchain."""
with warnings.catch_warnings():
warnings.simplefilter("ignore", DeprecationWarning)

from braintrust_langchain import (
BraintrustCallbackHandler,
set_global_handler,
)

assert callable(BraintrustCallbackHandler)
assert callable(set_global_handler)


def test_deprecation_warning():
"""Importing braintrust_langchain should emit a DeprecationWarning."""
import braintrust_langchain

with pytest.warns(DeprecationWarning, match="braintrust-langchain is deprecated"):
importlib.reload(braintrust_langchain)
33 changes: 0 additions & 33 deletions integrations/langchain-py/src/tests/types.py

This file was deleted.

Loading
Loading