diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 575b5dc0..a805242a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -49,7 +49,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - python-version: ['3.9', '3.10', '3.11', '3.12', '3.13'] + python-version: ['3.10', '3.11', '3.12', '3.13'] steps: - uses: actions/checkout@85e6279cec87321a52edac9c87bce653a07cf6c2 diff --git a/CHANGELOG.md b/CHANGELOG.md index 14f6f65e..3fd6d30d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,17 @@ +# 7.0.0 - 2025-11-11 + +NB Python 3.9 is no longer supported + +- chore(llma): update LLM provider SDKs to latest major versions + - openai: 1.102.0 → 2.7.1 + - anthropic: 0.64.0 → 0.72.0 + - google-genai: 1.32.0 → 1.49.0 + - langchain-core: 0.3.75 → 1.0.3 + - langchain-openai: 0.3.32 → 1.0.2 + - langchain-anthropic: 0.3.19 → 1.0.1 + - langchain-community: 0.3.29 → 0.4.1 + - langgraph: 0.6.6 → 1.0.2 + # 6.9.3 - 2025-11-10 - feat(ph-ai): PostHog properties dict in GenerationMetadata diff --git a/README.md b/README.md index ffdb6af3..36fa6969 100644 --- a/README.md +++ b/README.md @@ -30,8 +30,8 @@ We recommend using [uv](https://docs.astral.sh/uv/). It's super fast. ## PostHog recommends `uv` so... ```bash -uv python install 3.9.19 -uv python pin 3.9.19 +uv python install 3.12 +uv python pin 3.12 uv venv source env/bin/activate uv sync --extra dev --extra test diff --git a/posthog/ai/langchain/callbacks.py b/posthog/ai/langchain/callbacks.py index 9a2d16d9..68840a63 100644 --- a/posthog/ai/langchain/callbacks.py +++ b/posthog/ai/langchain/callbacks.py @@ -1,8 +1,8 @@ try: - import langchain # noqa: F401 + import langchain_core # noqa: F401 except ImportError: raise ModuleNotFoundError( - "Please install LangChain to use this feature: 'pip install langchain'" + "Please install LangChain to use this feature: 'pip install langchain-core'" ) import json diff --git a/posthog/test/ai/langchain/__init__.py b/posthog/test/ai/langchain/__init__.py index 00f6a7cf..a7a40c96 100644 --- a/posthog/test/ai/langchain/__init__.py +++ b/posthog/test/ai/langchain/__init__.py @@ -1,5 +1,5 @@ import pytest -pytest.importorskip("langchain") +pytest.importorskip("langchain_core") pytest.importorskip("langchain_community") pytest.importorskip("langgraph") diff --git a/posthog/test/ai/langchain/test_callbacks.py b/posthog/test/ai/langchain/test_callbacks.py index 632f8441..b9538532 100644 --- a/posthog/test/ai/langchain/test_callbacks.py +++ b/posthog/test/ai/langchain/test_callbacks.py @@ -1125,9 +1125,9 @@ def test_anthropic_chain(mock_client): ) chain = prompt | ChatAnthropic( api_key=ANTHROPIC_API_KEY, - model="claude-3-opus-20240229", + model="claude-sonnet-4-5-20250929", temperature=0, - max_tokens=1, + max_tokens=1024, ) callbacks = CallbackHandler( mock_client, @@ -1150,12 +1150,12 @@ def test_anthropic_chain(mock_client): assert gen_args["event"] == "$ai_generation" assert gen_props["$ai_trace_id"] == "test-trace-id" assert gen_props["$ai_provider"] == "anthropic" - assert gen_props["$ai_model"] == "claude-3-opus-20240229" + assert gen_props["$ai_model"] == "claude-sonnet-4-5-20250929" assert gen_props["foo"] == "bar" assert gen_props["$ai_model_parameters"] == { "temperature": 0.0, - "max_tokens": 1, + "max_tokens": 1024, "streaming": False, } assert gen_props["$ai_input"] == [ @@ -1171,7 +1171,7 @@ def test_anthropic_chain(mock_client): <= approximate_latency ) assert gen_props["$ai_input_tokens"] == 17 - assert gen_props["$ai_output_tokens"] == 1 + assert gen_props["$ai_output_tokens"] == 4 assert trace_args["event"] == "$ai_trace" assert trace_props["$ai_input_state"] == {} @@ -1188,9 +1188,9 @@ async def test_async_anthropic_streaming(mock_client): ) chain = prompt | ChatAnthropic( api_key=ANTHROPIC_API_KEY, - model="claude-3-opus-20240229", + model="claude-sonnet-4-5-20250929", temperature=0, - max_tokens=1, + max_tokens=1024, streaming=True, stream_usage=True, ) diff --git a/posthog/version.py b/posthog/version.py index b5fdd4f3..b2db8f69 100644 --- a/posthog/version.py +++ b/posthog/version.py @@ -1,4 +1,4 @@ -VERSION = "6.9.3" +VERSION = "7.0.0" if __name__ == "__main__": print(VERSION, end="") # noqa: T201 diff --git a/pyproject.toml b/pyproject.toml index 01bb8eb9..5c05af92 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -10,14 +10,13 @@ authors = [{ name = "PostHog", email = "hey@posthog.com" }] maintainers = [{ name = "PostHog", email = "hey@posthog.com" }] license = { text = "MIT" } readme = "README.md" -requires-python = ">=3.9" +requires-python = ">=3.10" classifiers = [ "Development Status :: 5 - Production/Stable", "Intended Audience :: Developers", "Operating System :: OS Independent", "License :: OSI Approved :: MIT License", "Programming Language :: Python", - "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", @@ -66,13 +65,13 @@ test = [ "pytest-timeout", "pytest-asyncio", "django", - "openai", - "anthropic", - "langgraph>=0.4.8", - "langchain-core>=0.3.65", - "langchain-community>=0.3.25", - "langchain-openai>=0.3.22", - "langchain-anthropic>=0.3.15", + "openai>=2.0", + "anthropic>=0.72", + "langgraph>=1.0", + "langchain-core>=1.0", + "langchain-community>=0.4", + "langchain-openai>=1.0", + "langchain-anthropic>=1.0", "google-genai", "pydantic", "parameterized>=0.8.1", diff --git a/setup.py b/setup.py index b24452de..ee62a9e3 100644 --- a/setup.py +++ b/setup.py @@ -14,7 +14,7 @@ PostHog is developer-friendly, self-hosted product analytics. posthog-python is the python package. -This package requires Python 3.9 or higher. +This package requires Python 3.10 or higher. """ # Minimal setup.py for backward compatibility diff --git a/setup_analytics.py b/setup_analytics.py index 51ccdfb7..f4854180 100644 --- a/setup_analytics.py +++ b/setup_analytics.py @@ -47,7 +47,7 @@ PostHog is developer-friendly, self-hosted product analytics. posthog-python is the python package. -This package requires Python 3.9 or higher. +This package requires Python 3.10 or higher. """ # Minimal setup.py for backward compatibility