posthoganalytics 6.9.2__tar.gz → 7.0.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (62) hide show
  1. {posthoganalytics-6.9.2/posthoganalytics.egg-info → posthoganalytics-7.0.0}/PKG-INFO +11 -12
  2. {posthoganalytics-6.9.2 → posthoganalytics-7.0.0}/README.md +2 -2
  3. {posthoganalytics-6.9.2 → posthoganalytics-7.0.0}/posthoganalytics/ai/langchain/callbacks.py +9 -2
  4. {posthoganalytics-6.9.2 → posthoganalytics-7.0.0}/posthoganalytics/version.py +1 -1
  5. {posthoganalytics-6.9.2 → posthoganalytics-7.0.0/posthoganalytics.egg-info}/PKG-INFO +11 -12
  6. {posthoganalytics-6.9.2 → posthoganalytics-7.0.0}/posthoganalytics.egg-info/requires.txt +7 -7
  7. {posthoganalytics-6.9.2 → posthoganalytics-7.0.0}/pyproject.toml +8 -9
  8. {posthoganalytics-6.9.2 → posthoganalytics-7.0.0}/setup.py +1 -1
  9. {posthoganalytics-6.9.2 → posthoganalytics-7.0.0}/setup_analytics.py +1 -1
  10. {posthoganalytics-6.9.2 → posthoganalytics-7.0.0}/LICENSE +0 -0
  11. {posthoganalytics-6.9.2 → posthoganalytics-7.0.0}/MANIFEST.in +0 -0
  12. {posthoganalytics-6.9.2 → posthoganalytics-7.0.0}/posthoganalytics/__init__.py +0 -0
  13. {posthoganalytics-6.9.2 → posthoganalytics-7.0.0}/posthoganalytics/ai/__init__.py +0 -0
  14. {posthoganalytics-6.9.2 → posthoganalytics-7.0.0}/posthoganalytics/ai/anthropic/__init__.py +0 -0
  15. {posthoganalytics-6.9.2 → posthoganalytics-7.0.0}/posthoganalytics/ai/anthropic/anthropic.py +0 -0
  16. {posthoganalytics-6.9.2 → posthoganalytics-7.0.0}/posthoganalytics/ai/anthropic/anthropic_async.py +0 -0
  17. {posthoganalytics-6.9.2 → posthoganalytics-7.0.0}/posthoganalytics/ai/anthropic/anthropic_converter.py +0 -0
  18. {posthoganalytics-6.9.2 → posthoganalytics-7.0.0}/posthoganalytics/ai/anthropic/anthropic_providers.py +0 -0
  19. {posthoganalytics-6.9.2 → posthoganalytics-7.0.0}/posthoganalytics/ai/gemini/__init__.py +0 -0
  20. {posthoganalytics-6.9.2 → posthoganalytics-7.0.0}/posthoganalytics/ai/gemini/gemini.py +0 -0
  21. {posthoganalytics-6.9.2 → posthoganalytics-7.0.0}/posthoganalytics/ai/gemini/gemini_converter.py +0 -0
  22. {posthoganalytics-6.9.2 → posthoganalytics-7.0.0}/posthoganalytics/ai/langchain/__init__.py +0 -0
  23. {posthoganalytics-6.9.2 → posthoganalytics-7.0.0}/posthoganalytics/ai/openai/__init__.py +0 -0
  24. {posthoganalytics-6.9.2 → posthoganalytics-7.0.0}/posthoganalytics/ai/openai/openai.py +0 -0
  25. {posthoganalytics-6.9.2 → posthoganalytics-7.0.0}/posthoganalytics/ai/openai/openai_async.py +0 -0
  26. {posthoganalytics-6.9.2 → posthoganalytics-7.0.0}/posthoganalytics/ai/openai/openai_converter.py +0 -0
  27. {posthoganalytics-6.9.2 → posthoganalytics-7.0.0}/posthoganalytics/ai/openai/openai_providers.py +0 -0
  28. {posthoganalytics-6.9.2 → posthoganalytics-7.0.0}/posthoganalytics/ai/sanitization.py +0 -0
  29. {posthoganalytics-6.9.2 → posthoganalytics-7.0.0}/posthoganalytics/ai/types.py +0 -0
  30. {posthoganalytics-6.9.2 → posthoganalytics-7.0.0}/posthoganalytics/ai/utils.py +0 -0
  31. {posthoganalytics-6.9.2 → posthoganalytics-7.0.0}/posthoganalytics/args.py +0 -0
  32. {posthoganalytics-6.9.2 → posthoganalytics-7.0.0}/posthoganalytics/client.py +0 -0
  33. {posthoganalytics-6.9.2 → posthoganalytics-7.0.0}/posthoganalytics/consumer.py +0 -0
  34. {posthoganalytics-6.9.2 → posthoganalytics-7.0.0}/posthoganalytics/contexts.py +0 -0
  35. {posthoganalytics-6.9.2 → posthoganalytics-7.0.0}/posthoganalytics/exception_capture.py +0 -0
  36. {posthoganalytics-6.9.2 → posthoganalytics-7.0.0}/posthoganalytics/exception_utils.py +0 -0
  37. {posthoganalytics-6.9.2 → posthoganalytics-7.0.0}/posthoganalytics/feature_flags.py +0 -0
  38. {posthoganalytics-6.9.2 → posthoganalytics-7.0.0}/posthoganalytics/integrations/__init__.py +0 -0
  39. {posthoganalytics-6.9.2 → posthoganalytics-7.0.0}/posthoganalytics/integrations/django.py +0 -0
  40. {posthoganalytics-6.9.2 → posthoganalytics-7.0.0}/posthoganalytics/poller.py +0 -0
  41. {posthoganalytics-6.9.2 → posthoganalytics-7.0.0}/posthoganalytics/py.typed +0 -0
  42. {posthoganalytics-6.9.2 → posthoganalytics-7.0.0}/posthoganalytics/request.py +0 -0
  43. {posthoganalytics-6.9.2 → posthoganalytics-7.0.0}/posthoganalytics/test/__init__.py +0 -0
  44. {posthoganalytics-6.9.2 → posthoganalytics-7.0.0}/posthoganalytics/test/test_before_send.py +0 -0
  45. {posthoganalytics-6.9.2 → posthoganalytics-7.0.0}/posthoganalytics/test/test_client.py +0 -0
  46. {posthoganalytics-6.9.2 → posthoganalytics-7.0.0}/posthoganalytics/test/test_consumer.py +0 -0
  47. {posthoganalytics-6.9.2 → posthoganalytics-7.0.0}/posthoganalytics/test/test_contexts.py +0 -0
  48. {posthoganalytics-6.9.2 → posthoganalytics-7.0.0}/posthoganalytics/test/test_exception_capture.py +0 -0
  49. {posthoganalytics-6.9.2 → posthoganalytics-7.0.0}/posthoganalytics/test/test_feature_flag.py +0 -0
  50. {posthoganalytics-6.9.2 → posthoganalytics-7.0.0}/posthoganalytics/test/test_feature_flag_result.py +0 -0
  51. {posthoganalytics-6.9.2 → posthoganalytics-7.0.0}/posthoganalytics/test/test_feature_flags.py +0 -0
  52. {posthoganalytics-6.9.2 → posthoganalytics-7.0.0}/posthoganalytics/test/test_module.py +0 -0
  53. {posthoganalytics-6.9.2 → posthoganalytics-7.0.0}/posthoganalytics/test/test_request.py +0 -0
  54. {posthoganalytics-6.9.2 → posthoganalytics-7.0.0}/posthoganalytics/test/test_size_limited_dict.py +0 -0
  55. {posthoganalytics-6.9.2 → posthoganalytics-7.0.0}/posthoganalytics/test/test_types.py +0 -0
  56. {posthoganalytics-6.9.2 → posthoganalytics-7.0.0}/posthoganalytics/test/test_utils.py +0 -0
  57. {posthoganalytics-6.9.2 → posthoganalytics-7.0.0}/posthoganalytics/types.py +0 -0
  58. {posthoganalytics-6.9.2 → posthoganalytics-7.0.0}/posthoganalytics/utils.py +0 -0
  59. {posthoganalytics-6.9.2 → posthoganalytics-7.0.0}/posthoganalytics.egg-info/SOURCES.txt +0 -0
  60. {posthoganalytics-6.9.2 → posthoganalytics-7.0.0}/posthoganalytics.egg-info/dependency_links.txt +0 -0
  61. {posthoganalytics-6.9.2 → posthoganalytics-7.0.0}/posthoganalytics.egg-info/top_level.txt +0 -0
  62. {posthoganalytics-6.9.2 → posthoganalytics-7.0.0}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: posthoganalytics
3
- Version: 6.9.2
3
+ Version: 7.0.0
4
4
  Summary: Integrate PostHog into any python application.
5
5
  Home-page: https://github.com/posthog/posthog-python
6
6
  Author: Posthog
@@ -15,12 +15,11 @@ Classifier: Intended Audience :: Developers
15
15
  Classifier: Operating System :: OS Independent
16
16
  Classifier: License :: OSI Approved :: MIT License
17
17
  Classifier: Programming Language :: Python
18
- Classifier: Programming Language :: Python :: 3.9
19
18
  Classifier: Programming Language :: Python :: 3.10
20
19
  Classifier: Programming Language :: Python :: 3.11
21
20
  Classifier: Programming Language :: Python :: 3.12
22
21
  Classifier: Programming Language :: Python :: 3.13
23
- Requires-Python: >=3.9
22
+ Requires-Python: >=3.10
24
23
  Description-Content-Type: text/markdown
25
24
  License-File: LICENSE
26
25
  Requires-Dist: requests<3.0,>=2.7
@@ -58,13 +57,13 @@ Requires-Dist: pytest; extra == "test"
58
57
  Requires-Dist: pytest-timeout; extra == "test"
59
58
  Requires-Dist: pytest-asyncio; extra == "test"
60
59
  Requires-Dist: django; extra == "test"
61
- Requires-Dist: openai; extra == "test"
62
- Requires-Dist: anthropic; extra == "test"
63
- Requires-Dist: langgraph>=0.4.8; extra == "test"
64
- Requires-Dist: langchain-core>=0.3.65; extra == "test"
65
- Requires-Dist: langchain-community>=0.3.25; extra == "test"
66
- Requires-Dist: langchain-openai>=0.3.22; extra == "test"
67
- Requires-Dist: langchain-anthropic>=0.3.15; extra == "test"
60
+ Requires-Dist: openai>=2.0; extra == "test"
61
+ Requires-Dist: anthropic>=0.72; extra == "test"
62
+ Requires-Dist: langgraph>=1.0; extra == "test"
63
+ Requires-Dist: langchain-core>=1.0; extra == "test"
64
+ Requires-Dist: langchain-community>=0.4; extra == "test"
65
+ Requires-Dist: langchain-openai>=1.0; extra == "test"
66
+ Requires-Dist: langchain-anthropic>=1.0; extra == "test"
68
67
  Requires-Dist: google-genai; extra == "test"
69
68
  Requires-Dist: pydantic; extra == "test"
70
69
  Requires-Dist: parameterized>=0.8.1; extra == "test"
@@ -105,8 +104,8 @@ We recommend using [uv](https://docs.astral.sh/uv/). It's super fast.
105
104
  ## PostHog recommends `uv` so...
106
105
 
107
106
  ```bash
108
- uv python install 3.9.19
109
- uv python pin 3.9.19
107
+ uv python install 3.12
108
+ uv python pin 3.12
110
109
  uv venv
111
110
  source env/bin/activate
112
111
  uv sync --extra dev --extra test
@@ -30,8 +30,8 @@ We recommend using [uv](https://docs.astral.sh/uv/). It's super fast.
30
30
  ## PostHog recommends `uv` so...
31
31
 
32
32
  ```bash
33
- uv python install 3.9.19
34
- uv python pin 3.9.19
33
+ uv python install 3.12
34
+ uv python pin 3.12
35
35
  uv venv
36
36
  source env/bin/activate
37
37
  uv sync --extra dev --extra test
@@ -1,8 +1,8 @@
1
1
  try:
2
- import langchain # noqa: F401
2
+ import langchain_core # noqa: F401
3
3
  except ImportError:
4
4
  raise ModuleNotFoundError(
5
- "Please install LangChain to use this feature: 'pip install langchain'"
5
+ "Please install LangChain to use this feature: 'pip install langchain-core'"
6
6
  )
7
7
 
8
8
  import json
@@ -79,6 +79,8 @@ class GenerationMetadata(SpanMetadata):
79
79
  """Base URL of the provider's API used in the run."""
80
80
  tools: Optional[List[Dict[str, Any]]] = None
81
81
  """Tools provided to the model."""
82
+ posthog_properties: Optional[Dict[str, Any]] = None
83
+ """PostHog properties of the run."""
82
84
 
83
85
 
84
86
  RunMetadata = Union[SpanMetadata, GenerationMetadata]
@@ -420,6 +422,8 @@ class CallbackHandler(BaseCallbackHandler):
420
422
  generation.model = model
421
423
  if provider := metadata.get("ls_provider"):
422
424
  generation.provider = provider
425
+
426
+ generation.posthog_properties = metadata.get("posthog_properties")
423
427
  try:
424
428
  base_url = serialized["kwargs"]["openai_api_base"]
425
429
  if base_url is not None:
@@ -566,6 +570,9 @@ class CallbackHandler(BaseCallbackHandler):
566
570
  "$ai_framework": "langchain",
567
571
  }
568
572
 
573
+ if isinstance(run.posthog_properties, dict):
574
+ event_properties.update(run.posthog_properties)
575
+
569
576
  if run.tools:
570
577
  event_properties["$ai_tools"] = run.tools
571
578
 
@@ -1,4 +1,4 @@
1
- VERSION = "6.9.2"
1
+ VERSION = "7.0.0"
2
2
 
3
3
  if __name__ == "__main__":
4
4
  print(VERSION, end="") # noqa: T201
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: posthoganalytics
3
- Version: 6.9.2
3
+ Version: 7.0.0
4
4
  Summary: Integrate PostHog into any python application.
5
5
  Home-page: https://github.com/posthog/posthog-python
6
6
  Author: Posthog
@@ -15,12 +15,11 @@ Classifier: Intended Audience :: Developers
15
15
  Classifier: Operating System :: OS Independent
16
16
  Classifier: License :: OSI Approved :: MIT License
17
17
  Classifier: Programming Language :: Python
18
- Classifier: Programming Language :: Python :: 3.9
19
18
  Classifier: Programming Language :: Python :: 3.10
20
19
  Classifier: Programming Language :: Python :: 3.11
21
20
  Classifier: Programming Language :: Python :: 3.12
22
21
  Classifier: Programming Language :: Python :: 3.13
23
- Requires-Python: >=3.9
22
+ Requires-Python: >=3.10
24
23
  Description-Content-Type: text/markdown
25
24
  License-File: LICENSE
26
25
  Requires-Dist: requests<3.0,>=2.7
@@ -58,13 +57,13 @@ Requires-Dist: pytest; extra == "test"
58
57
  Requires-Dist: pytest-timeout; extra == "test"
59
58
  Requires-Dist: pytest-asyncio; extra == "test"
60
59
  Requires-Dist: django; extra == "test"
61
- Requires-Dist: openai; extra == "test"
62
- Requires-Dist: anthropic; extra == "test"
63
- Requires-Dist: langgraph>=0.4.8; extra == "test"
64
- Requires-Dist: langchain-core>=0.3.65; extra == "test"
65
- Requires-Dist: langchain-community>=0.3.25; extra == "test"
66
- Requires-Dist: langchain-openai>=0.3.22; extra == "test"
67
- Requires-Dist: langchain-anthropic>=0.3.15; extra == "test"
60
+ Requires-Dist: openai>=2.0; extra == "test"
61
+ Requires-Dist: anthropic>=0.72; extra == "test"
62
+ Requires-Dist: langgraph>=1.0; extra == "test"
63
+ Requires-Dist: langchain-core>=1.0; extra == "test"
64
+ Requires-Dist: langchain-community>=0.4; extra == "test"
65
+ Requires-Dist: langchain-openai>=1.0; extra == "test"
66
+ Requires-Dist: langchain-anthropic>=1.0; extra == "test"
68
67
  Requires-Dist: google-genai; extra == "test"
69
68
  Requires-Dist: pydantic; extra == "test"
70
69
  Requires-Dist: parameterized>=0.8.1; extra == "test"
@@ -105,8 +104,8 @@ We recommend using [uv](https://docs.astral.sh/uv/). It's super fast.
105
104
  ## PostHog recommends `uv` so...
106
105
 
107
106
  ```bash
108
- uv python install 3.9.19
109
- uv python pin 3.9.19
107
+ uv python install 3.12
108
+ uv python pin 3.12
110
109
  uv venv
111
110
  source env/bin/activate
112
111
  uv sync --extra dev --extra test
@@ -36,13 +36,13 @@ pytest
36
36
  pytest-timeout
37
37
  pytest-asyncio
38
38
  django
39
- openai
40
- anthropic
41
- langgraph>=0.4.8
42
- langchain-core>=0.3.65
43
- langchain-community>=0.3.25
44
- langchain-openai>=0.3.22
45
- langchain-anthropic>=0.3.15
39
+ openai>=2.0
40
+ anthropic>=0.72
41
+ langgraph>=1.0
42
+ langchain-core>=1.0
43
+ langchain-community>=0.4
44
+ langchain-openai>=1.0
45
+ langchain-anthropic>=1.0
46
46
  google-genai
47
47
  pydantic
48
48
  parameterized>=0.8.1
@@ -18,14 +18,13 @@ maintainers = [
18
18
  { name = "PostHog", email = "hey@posthog.com" },
19
19
  ]
20
20
  readme = "README.md"
21
- requires-python = ">=3.9"
21
+ requires-python = ">=3.10"
22
22
  classifiers = [
23
23
  "Development Status :: 5 - Production/Stable",
24
24
  "Intended Audience :: Developers",
25
25
  "Operating System :: OS Independent",
26
26
  "License :: OSI Approved :: MIT License",
27
27
  "Programming Language :: Python",
28
- "Programming Language :: Python :: 3.9",
29
28
  "Programming Language :: Python :: 3.10",
30
29
  "Programming Language :: Python :: 3.11",
31
30
  "Programming Language :: Python :: 3.12",
@@ -79,13 +78,13 @@ test = [
79
78
  "pytest-timeout",
80
79
  "pytest-asyncio",
81
80
  "django",
82
- "openai",
83
- "anthropic",
84
- "langgraph>=0.4.8",
85
- "langchain-core>=0.3.65",
86
- "langchain-community>=0.3.25",
87
- "langchain-openai>=0.3.22",
88
- "langchain-anthropic>=0.3.15",
81
+ "openai>=2.0",
82
+ "anthropic>=0.72",
83
+ "langgraph>=1.0",
84
+ "langchain-core>=1.0",
85
+ "langchain-community>=0.4",
86
+ "langchain-openai>=1.0",
87
+ "langchain-anthropic>=1.0",
89
88
  "google-genai",
90
89
  "pydantic",
91
90
  "parameterized>=0.8.1",
@@ -14,7 +14,7 @@ long_description = """
14
14
  PostHog is developer-friendly, self-hosted product analytics.
15
15
  posthog-python is the python package.
16
16
 
17
- This package requires Python 3.9 or higher.
17
+ This package requires Python 3.10 or higher.
18
18
  """
19
19
 
20
20
  # Minimal setup.py for backward compatibility
@@ -47,7 +47,7 @@ long_description = """
47
47
  PostHog is developer-friendly, self-hosted product analytics.
48
48
  posthog-python is the python package.
49
49
 
50
- This package requires Python 3.9 or higher.
50
+ This package requires Python 3.10 or higher.
51
51
  """
52
52
 
53
53
  # Minimal setup.py for backward compatibility