posthog 4.9.0__tar.gz → 6.7.13__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 (78) hide show
  1. {posthog-4.9.0/posthog.egg-info → posthog-6.7.13}/PKG-INFO +19 -21
  2. {posthog-4.9.0 → posthog-6.7.13}/README.md +17 -17
  3. posthog-6.7.13/posthog/__init__.py +765 -0
  4. {posthog-4.9.0 → posthog-6.7.13}/posthog/ai/anthropic/__init__.py +10 -0
  5. {posthog-4.9.0 → posthog-6.7.13}/posthog/ai/anthropic/anthropic.py +98 -67
  6. {posthog-4.9.0 → posthog-6.7.13}/posthog/ai/anthropic/anthropic_async.py +93 -25
  7. posthog-6.7.13/posthog/ai/anthropic/anthropic_converter.py +403 -0
  8. {posthog-4.9.0 → posthog-6.7.13}/posthog/ai/anthropic/anthropic_providers.py +11 -8
  9. posthog-6.7.13/posthog/ai/gemini/__init__.py +22 -0
  10. {posthog-4.9.0 → posthog-6.7.13}/posthog/ai/gemini/gemini.py +139 -85
  11. posthog-6.7.13/posthog/ai/gemini/gemini_converter.py +516 -0
  12. {posthog-4.9.0 → posthog-6.7.13}/posthog/ai/langchain/callbacks.py +66 -25
  13. posthog-6.7.13/posthog/ai/openai/__init__.py +20 -0
  14. {posthog-4.9.0 → posthog-6.7.13}/posthog/ai/openai/openai.py +125 -186
  15. {posthog-4.9.0 → posthog-6.7.13}/posthog/ai/openai/openai_async.py +94 -119
  16. posthog-6.7.13/posthog/ai/openai/openai_converter.py +611 -0
  17. {posthog-4.9.0 → posthog-6.7.13}/posthog/ai/openai/openai_providers.py +7 -4
  18. posthog-6.7.13/posthog/ai/sanitization.py +226 -0
  19. posthog-6.7.13/posthog/ai/types.py +124 -0
  20. posthog-6.7.13/posthog/ai/utils.py +559 -0
  21. posthog-6.7.13/posthog/args.py +71 -0
  22. posthog-6.7.13/posthog/client.py +2067 -0
  23. posthog-6.7.13/posthog/contexts.py +284 -0
  24. {posthog-4.9.0 → posthog-6.7.13}/posthog/exception_capture.py +3 -25
  25. {posthog-4.9.0 → posthog-6.7.13}/posthog/exception_utils.py +140 -180
  26. {posthog-4.9.0 → posthog-6.7.13}/posthog/feature_flags.py +260 -19
  27. posthog-6.7.13/posthog/integrations/django.py +251 -0
  28. posthog-6.7.13/posthog/py.typed +0 -0
  29. {posthog-4.9.0 → posthog-6.7.13}/posthog/request.py +6 -2
  30. posthog-6.7.13/posthog/test/test_before_send.py +218 -0
  31. posthog-6.7.13/posthog/test/test_client.py +2468 -0
  32. posthog-6.7.13/posthog/test/test_contexts.py +207 -0
  33. posthog-6.7.13/posthog/test/test_exception_capture.py +34 -0
  34. {posthog-4.9.0 → posthog-6.7.13}/posthog/test/test_feature_flag_result.py +12 -12
  35. {posthog-4.9.0 → posthog-6.7.13}/posthog/test/test_feature_flags.py +1286 -66
  36. posthog-6.7.13/posthog/test/test_module.py +32 -0
  37. {posthog-4.9.0 → posthog-6.7.13}/posthog/test/test_utils.py +123 -0
  38. {posthog-4.9.0 → posthog-6.7.13}/posthog/types.py +29 -3
  39. posthog-6.7.13/posthog/utils.py +519 -0
  40. {posthog-4.9.0 → posthog-6.7.13}/posthog/version.py +1 -1
  41. {posthog-4.9.0 → posthog-6.7.13/posthog.egg-info}/PKG-INFO +19 -21
  42. {posthog-4.9.0 → posthog-6.7.13}/posthog.egg-info/SOURCES.txt +10 -7
  43. {posthog-4.9.0 → posthog-6.7.13}/posthog.egg-info/requires.txt +1 -4
  44. {posthog-4.9.0 → posthog-6.7.13}/pyproject.toml +4 -5
  45. posthog-4.9.0/posthog/__init__.py +0 -622
  46. posthog-4.9.0/posthog/ai/gemini/__init__.py +0 -11
  47. posthog-4.9.0/posthog/ai/openai/__init__.py +0 -5
  48. posthog-4.9.0/posthog/ai/utils.py +0 -544
  49. posthog-4.9.0/posthog/client.py +0 -1441
  50. posthog-4.9.0/posthog/exception_integrations/__init__.py +0 -5
  51. posthog-4.9.0/posthog/exception_integrations/django.py +0 -117
  52. posthog-4.9.0/posthog/scopes.py +0 -127
  53. posthog-4.9.0/posthog/sentry/__init__.py +0 -1
  54. posthog-4.9.0/posthog/sentry/django.py +0 -28
  55. posthog-4.9.0/posthog/sentry/posthog_integration.py +0 -57
  56. posthog-4.9.0/posthog/test/test_before_send.py +0 -171
  57. posthog-4.9.0/posthog/test/test_client.py +0 -1463
  58. posthog-4.9.0/posthog/test/test_exception_capture.py +0 -63
  59. posthog-4.9.0/posthog/test/test_module.py +0 -50
  60. posthog-4.9.0/posthog/test/test_scopes.py +0 -138
  61. posthog-4.9.0/posthog/utils.py +0 -200
  62. {posthog-4.9.0 → posthog-6.7.13}/LICENSE +0 -0
  63. {posthog-4.9.0 → posthog-6.7.13}/MANIFEST.in +0 -0
  64. {posthog-4.9.0 → posthog-6.7.13}/posthog/ai/__init__.py +0 -0
  65. {posthog-4.9.0 → posthog-6.7.13}/posthog/ai/langchain/__init__.py +0 -0
  66. {posthog-4.9.0 → posthog-6.7.13}/posthog/consumer.py +0 -0
  67. /posthog-4.9.0/posthog/py.typed → /posthog-6.7.13/posthog/integrations/__init__.py +0 -0
  68. {posthog-4.9.0 → posthog-6.7.13}/posthog/poller.py +0 -0
  69. {posthog-4.9.0 → posthog-6.7.13}/posthog/test/__init__.py +0 -0
  70. {posthog-4.9.0 → posthog-6.7.13}/posthog/test/test_consumer.py +0 -0
  71. {posthog-4.9.0 → posthog-6.7.13}/posthog/test/test_feature_flag.py +0 -0
  72. {posthog-4.9.0 → posthog-6.7.13}/posthog/test/test_request.py +0 -0
  73. {posthog-4.9.0 → posthog-6.7.13}/posthog/test/test_size_limited_dict.py +0 -0
  74. {posthog-4.9.0 → posthog-6.7.13}/posthog/test/test_types.py +0 -0
  75. {posthog-4.9.0 → posthog-6.7.13}/posthog.egg-info/dependency_links.txt +0 -0
  76. {posthog-4.9.0 → posthog-6.7.13}/posthog.egg-info/top_level.txt +0 -0
  77. {posthog-4.9.0 → posthog-6.7.13}/setup.cfg +0 -0
  78. {posthog-4.9.0 → posthog-6.7.13}/setup.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: posthog
3
- Version: 4.9.0
3
+ Version: 6.7.13
4
4
  Summary: Integrate PostHog into any python application.
5
5
  Home-page: https://github.com/posthog/posthog-python
6
6
  Author: Posthog
@@ -28,9 +28,7 @@ Requires-Dist: six>=1.5
28
28
  Requires-Dist: python-dateutil>=2.2
29
29
  Requires-Dist: backoff>=1.10.0
30
30
  Requires-Dist: distro>=1.5.0
31
- Provides-Extra: sentry
32
- Requires-Dist: sentry-sdk; extra == "sentry"
33
- Requires-Dist: django; extra == "sentry"
31
+ Requires-Dist: typing-extensions>=4.2.0
34
32
  Provides-Extra: langchain
35
33
  Requires-Dist: langchain>=0.2.0; extra == "langchain"
36
34
  Provides-Extra: dev
@@ -109,7 +107,7 @@ We recommend using [uv](https://docs.astral.sh/uv/). It's super fast.
109
107
  ```bash
110
108
  uv python install 3.9.19
111
109
  uv python pin 3.9.19
112
- uv venv env
110
+ uv venv
113
111
  source env/bin/activate
114
112
  uv sync --extra dev --extra test
115
113
  pre-commit install
@@ -120,24 +118,24 @@ make test
120
118
 
121
119
  Assuming you have a [local version of PostHog](https://posthog.com/docs/developing-locally) running, you can run `python3 example.py` to see the library in action.
122
120
 
123
- ### Running the Django Sentry Integration Locally
124
-
125
- There's a sample Django project included, called `sentry_django_example`, which explains how to use PostHog with Sentry.
121
+ ### Releasing Versions
126
122
 
127
- There's 2 places of importance (Changes required are all marked with TODO in the sample project directory)
123
+ Updates are released automatically using GitHub Actions when `version.py` is updated on `master`. After bumping `version.py` in `master` and adding to `CHANGELOG.md`, the [release workflow](https://github.com/PostHog/posthog-python/blob/master/.github/workflows/release.yaml) will automatically trigger and deploy the new version.
128
124
 
129
- 1. Settings.py
130
- 1. Input your Sentry DSN
131
- 2. Input your Sentry Org and ProjectID details into `PosthogIntegration()`
132
- 3. Add `POSTHOG_DJANGO` to settings.py. This allows the `PosthogDistinctIdMiddleware` to get the distinct_ids
125
+ If you need to check the latest runs or manually trigger a release, you can go to [our release workflow's page](https://github.com/PostHog/posthog-python/actions/workflows/release.yaml) and dispatch it manually, using workflow from `master`.
133
126
 
134
- 2. urls.py
135
- 1. This includes the `sentry-debug/` endpoint, which generates an exception
136
127
 
137
- To run things: `make django_example`. This installs the posthog-python library with the sentry-sdk add-on, and then runs the django app.
138
- Also start the PostHog app locally.
139
- Then navigate to `http://127.0.0.1:8080/sentry-debug/` and you should get an event in both Sentry and PostHog, with links to each other.
128
+ ### Testing changes locally with the PostHog app
140
129
 
141
- ### Releasing Versions
142
-
143
- Updated are released using GitHub Actions: after bumping `version.py` in `master` and adding to `CHANGELOG.md`, go to [our release workflow's page](https://github.com/PostHog/posthog-python/actions/workflows/release.yaml) and dispatch it manually, using workflow from `master`.
130
+ You can run `make prep_local`, and it'll create a new folder alongside the SDK repo one called `posthog-python-local`, which you can then import into the posthog project by changing pyproject.toml to look like this:
131
+ ```toml
132
+ dependencies = [
133
+ ...
134
+ "posthoganalytics" #NOTE: no version number
135
+ ...
136
+ ]
137
+ ...
138
+ [tools.uv.sources]
139
+ posthoganalytics = { path = "../posthog-python-local" }
140
+ ```
141
+ This'll let you build and test SDK changes fully locally, incorporating them into your local posthog app stack. It mainly takes care of the `posthog -> posthoganalytics` module renaming. You'll need to re-run `make prep_local` each time you make a change, and re-run `uv sync --active` in the posthog app project.
@@ -32,7 +32,7 @@ We recommend using [uv](https://docs.astral.sh/uv/). It's super fast.
32
32
  ```bash
33
33
  uv python install 3.9.19
34
34
  uv python pin 3.9.19
35
- uv venv env
35
+ uv venv
36
36
  source env/bin/activate
37
37
  uv sync --extra dev --extra test
38
38
  pre-commit install
@@ -43,24 +43,24 @@ make test
43
43
 
44
44
  Assuming you have a [local version of PostHog](https://posthog.com/docs/developing-locally) running, you can run `python3 example.py` to see the library in action.
45
45
 
46
- ### Running the Django Sentry Integration Locally
47
-
48
- There's a sample Django project included, called `sentry_django_example`, which explains how to use PostHog with Sentry.
46
+ ### Releasing Versions
49
47
 
50
- There's 2 places of importance (Changes required are all marked with TODO in the sample project directory)
48
+ Updates are released automatically using GitHub Actions when `version.py` is updated on `master`. After bumping `version.py` in `master` and adding to `CHANGELOG.md`, the [release workflow](https://github.com/PostHog/posthog-python/blob/master/.github/workflows/release.yaml) will automatically trigger and deploy the new version.
51
49
 
52
- 1. Settings.py
53
- 1. Input your Sentry DSN
54
- 2. Input your Sentry Org and ProjectID details into `PosthogIntegration()`
55
- 3. Add `POSTHOG_DJANGO` to settings.py. This allows the `PosthogDistinctIdMiddleware` to get the distinct_ids
50
+ If you need to check the latest runs or manually trigger a release, you can go to [our release workflow's page](https://github.com/PostHog/posthog-python/actions/workflows/release.yaml) and dispatch it manually, using workflow from `master`.
56
51
 
57
- 2. urls.py
58
- 1. This includes the `sentry-debug/` endpoint, which generates an exception
59
52
 
60
- To run things: `make django_example`. This installs the posthog-python library with the sentry-sdk add-on, and then runs the django app.
61
- Also start the PostHog app locally.
62
- Then navigate to `http://127.0.0.1:8080/sentry-debug/` and you should get an event in both Sentry and PostHog, with links to each other.
53
+ ### Testing changes locally with the PostHog app
63
54
 
64
- ### Releasing Versions
65
-
66
- Updated are released using GitHub Actions: after bumping `version.py` in `master` and adding to `CHANGELOG.md`, go to [our release workflow's page](https://github.com/PostHog/posthog-python/actions/workflows/release.yaml) and dispatch it manually, using workflow from `master`.
55
+ You can run `make prep_local`, and it'll create a new folder alongside the SDK repo one called `posthog-python-local`, which you can then import into the posthog project by changing pyproject.toml to look like this:
56
+ ```toml
57
+ dependencies = [
58
+ ...
59
+ "posthoganalytics" #NOTE: no version number
60
+ ...
61
+ ]
62
+ ...
63
+ [tools.uv.sources]
64
+ posthoganalytics = { path = "../posthog-python-local" }
65
+ ```
66
+ This'll let you build and test SDK changes fully locally, incorporating them into your local posthog app stack. It mainly takes care of the `posthog -> posthoganalytics` module renaming. You'll need to re-run `make prep_local` each time you make a change, and re-run `uv sync --active` in the posthog app project.