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
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
14 changes: 14 additions & 0 deletions CHANGELOG.md
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i've not done a release of the python SDK for ages.

i'd be tempted to make it clear in this changelog note that this removes python 3.9 support.

i'd guess there's no user action on how they use the SDK, just whether we explicitly support the version, so no need for a "how to upgrade from 6 to 7" note

if we wanted to be very neat then we'd have a PR that removes 3.9 support, and then a PR that does the llma upgrades and we release those two changes as v7 but imho just making it clear in the changelog is enough

Original file line number Diff line number Diff line change
@@ -1,3 +1,17 @@
# 7.0.0 - 2025-11-11

NB Python 3.9 is no longer supported
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

let's also make clear here that we're dropping pydantic 1.0 support too


- 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
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions posthog/ai/langchain/callbacks.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
try:
import langchain # noqa: F401
import langchain_core # noqa: F401
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@carlos-marchal-ph does this mean we would not support LC <1.* on latest posthog sdk?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's correct. That's why it's also a major release. It's not ideal but at least it gives user a choice, they can still stay on 6.9. I guess we could backport it and export it as langchain_v0.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hmm just trying to think through users who say have some agents working away using pre 1.0 LC but are doing all new agent dev in LC 1+

what would they do?

i think maybe would be problems for them?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not against any of this but just thinking through what if or worse case scenarios if lots of users start complaining

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nono, makes a lot of sense. I will implement an exported v0 wrapper. A shame that we are shipping all that code though, we really need to rethink how we approach the wrappers at some point.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah 100% going to only get more complicated

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hmm just trying to think through users who say have some agents working away using pre 1.0 LC but are doing all new agent dev in LC 1+

actually not even sure how possible that is actually - it might sort of be.

@carlos-marchal-ph one option is to just go as-is but we just be ready with a draft pr for the v0 wrapper as a backup in case needed maybe?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

eg maybe we just accept that we wont know (since we dont actually have version tracking in the sdk) and just be ready for if it does mess up a lot of folks

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That makes sense too. In any case won't merge until Monday just to be safe.

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
Expand Down
2 changes: 1 addition & 1 deletion posthog/test/ai/langchain/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import pytest

pytest.importorskip("langchain")
pytest.importorskip("langchain_core")
pytest.importorskip("langchain_community")
pytest.importorskip("langgraph")
14 changes: 7 additions & 7 deletions posthog/test/ai/langchain/test_callbacks.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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"] == [
Expand All @@ -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"] == {}
Expand All @@ -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,
)
Expand Down
2 changes: 1 addition & 1 deletion posthog/version.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
VERSION = "6.9.3"
VERSION = "7.0.0"

if __name__ == "__main__":
print(VERSION, end="") # noqa: T201
17 changes: 8 additions & 9 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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",
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion setup_analytics.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Loading