posthoganalytics 7.4.1__tar.gz → 7.4.2__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 (65) hide show
  1. {posthoganalytics-7.4.1/posthoganalytics.egg-info → posthoganalytics-7.4.2}/PKG-INFO +1 -1
  2. {posthoganalytics-7.4.1 → posthoganalytics-7.4.2}/posthoganalytics/__init__.py +27 -6
  3. {posthoganalytics-7.4.1 → posthoganalytics-7.4.2}/posthoganalytics/client.py +19 -16
  4. {posthoganalytics-7.4.1 → posthoganalytics-7.4.2}/posthoganalytics/exception_utils.py +3 -3
  5. {posthoganalytics-7.4.1 → posthoganalytics-7.4.2}/posthoganalytics/version.py +1 -1
  6. {posthoganalytics-7.4.1 → posthoganalytics-7.4.2/posthoganalytics.egg-info}/PKG-INFO +1 -1
  7. {posthoganalytics-7.4.1 → posthoganalytics-7.4.2}/LICENSE +0 -0
  8. {posthoganalytics-7.4.1 → posthoganalytics-7.4.2}/MANIFEST.in +0 -0
  9. {posthoganalytics-7.4.1 → posthoganalytics-7.4.2}/README.md +0 -0
  10. {posthoganalytics-7.4.1 → posthoganalytics-7.4.2}/posthoganalytics/ai/__init__.py +0 -0
  11. {posthoganalytics-7.4.1 → posthoganalytics-7.4.2}/posthoganalytics/ai/anthropic/__init__.py +0 -0
  12. {posthoganalytics-7.4.1 → posthoganalytics-7.4.2}/posthoganalytics/ai/anthropic/anthropic.py +0 -0
  13. {posthoganalytics-7.4.1 → posthoganalytics-7.4.2}/posthoganalytics/ai/anthropic/anthropic_async.py +0 -0
  14. {posthoganalytics-7.4.1 → posthoganalytics-7.4.2}/posthoganalytics/ai/anthropic/anthropic_converter.py +0 -0
  15. {posthoganalytics-7.4.1 → posthoganalytics-7.4.2}/posthoganalytics/ai/anthropic/anthropic_providers.py +0 -0
  16. {posthoganalytics-7.4.1 → posthoganalytics-7.4.2}/posthoganalytics/ai/gemini/__init__.py +0 -0
  17. {posthoganalytics-7.4.1 → posthoganalytics-7.4.2}/posthoganalytics/ai/gemini/gemini.py +0 -0
  18. {posthoganalytics-7.4.1 → posthoganalytics-7.4.2}/posthoganalytics/ai/gemini/gemini_async.py +0 -0
  19. {posthoganalytics-7.4.1 → posthoganalytics-7.4.2}/posthoganalytics/ai/gemini/gemini_converter.py +0 -0
  20. {posthoganalytics-7.4.1 → posthoganalytics-7.4.2}/posthoganalytics/ai/langchain/__init__.py +0 -0
  21. {posthoganalytics-7.4.1 → posthoganalytics-7.4.2}/posthoganalytics/ai/langchain/callbacks.py +0 -0
  22. {posthoganalytics-7.4.1 → posthoganalytics-7.4.2}/posthoganalytics/ai/openai/__init__.py +0 -0
  23. {posthoganalytics-7.4.1 → posthoganalytics-7.4.2}/posthoganalytics/ai/openai/openai.py +0 -0
  24. {posthoganalytics-7.4.1 → posthoganalytics-7.4.2}/posthoganalytics/ai/openai/openai_async.py +0 -0
  25. {posthoganalytics-7.4.1 → posthoganalytics-7.4.2}/posthoganalytics/ai/openai/openai_converter.py +0 -0
  26. {posthoganalytics-7.4.1 → posthoganalytics-7.4.2}/posthoganalytics/ai/openai/openai_providers.py +0 -0
  27. {posthoganalytics-7.4.1 → posthoganalytics-7.4.2}/posthoganalytics/ai/sanitization.py +0 -0
  28. {posthoganalytics-7.4.1 → posthoganalytics-7.4.2}/posthoganalytics/ai/types.py +0 -0
  29. {posthoganalytics-7.4.1 → posthoganalytics-7.4.2}/posthoganalytics/ai/utils.py +0 -0
  30. {posthoganalytics-7.4.1 → posthoganalytics-7.4.2}/posthoganalytics/args.py +0 -0
  31. {posthoganalytics-7.4.1 → posthoganalytics-7.4.2}/posthoganalytics/consumer.py +0 -0
  32. {posthoganalytics-7.4.1 → posthoganalytics-7.4.2}/posthoganalytics/contexts.py +0 -0
  33. {posthoganalytics-7.4.1 → posthoganalytics-7.4.2}/posthoganalytics/exception_capture.py +0 -0
  34. {posthoganalytics-7.4.1 → posthoganalytics-7.4.2}/posthoganalytics/feature_flags.py +0 -0
  35. {posthoganalytics-7.4.1 → posthoganalytics-7.4.2}/posthoganalytics/flag_definition_cache.py +0 -0
  36. {posthoganalytics-7.4.1 → posthoganalytics-7.4.2}/posthoganalytics/integrations/__init__.py +0 -0
  37. {posthoganalytics-7.4.1 → posthoganalytics-7.4.2}/posthoganalytics/integrations/django.py +0 -0
  38. {posthoganalytics-7.4.1 → posthoganalytics-7.4.2}/posthoganalytics/poller.py +0 -0
  39. {posthoganalytics-7.4.1 → posthoganalytics-7.4.2}/posthoganalytics/py.typed +0 -0
  40. {posthoganalytics-7.4.1 → posthoganalytics-7.4.2}/posthoganalytics/request.py +0 -0
  41. {posthoganalytics-7.4.1 → posthoganalytics-7.4.2}/posthoganalytics/test/__init__.py +0 -0
  42. {posthoganalytics-7.4.1 → posthoganalytics-7.4.2}/posthoganalytics/test/test_before_send.py +0 -0
  43. {posthoganalytics-7.4.1 → posthoganalytics-7.4.2}/posthoganalytics/test/test_client.py +0 -0
  44. {posthoganalytics-7.4.1 → posthoganalytics-7.4.2}/posthoganalytics/test/test_consumer.py +0 -0
  45. {posthoganalytics-7.4.1 → posthoganalytics-7.4.2}/posthoganalytics/test/test_contexts.py +0 -0
  46. {posthoganalytics-7.4.1 → posthoganalytics-7.4.2}/posthoganalytics/test/test_exception_capture.py +0 -0
  47. {posthoganalytics-7.4.1 → posthoganalytics-7.4.2}/posthoganalytics/test/test_feature_flag.py +0 -0
  48. {posthoganalytics-7.4.1 → posthoganalytics-7.4.2}/posthoganalytics/test/test_feature_flag_result.py +0 -0
  49. {posthoganalytics-7.4.1 → posthoganalytics-7.4.2}/posthoganalytics/test/test_feature_flags.py +0 -0
  50. {posthoganalytics-7.4.1 → posthoganalytics-7.4.2}/posthoganalytics/test/test_flag_definition_cache.py +0 -0
  51. {posthoganalytics-7.4.1 → posthoganalytics-7.4.2}/posthoganalytics/test/test_module.py +0 -0
  52. {posthoganalytics-7.4.1 → posthoganalytics-7.4.2}/posthoganalytics/test/test_request.py +0 -0
  53. {posthoganalytics-7.4.1 → posthoganalytics-7.4.2}/posthoganalytics/test/test_size_limited_dict.py +0 -0
  54. {posthoganalytics-7.4.1 → posthoganalytics-7.4.2}/posthoganalytics/test/test_types.py +0 -0
  55. {posthoganalytics-7.4.1 → posthoganalytics-7.4.2}/posthoganalytics/test/test_utils.py +0 -0
  56. {posthoganalytics-7.4.1 → posthoganalytics-7.4.2}/posthoganalytics/types.py +0 -0
  57. {posthoganalytics-7.4.1 → posthoganalytics-7.4.2}/posthoganalytics/utils.py +0 -0
  58. {posthoganalytics-7.4.1 → posthoganalytics-7.4.2}/posthoganalytics.egg-info/SOURCES.txt +0 -0
  59. {posthoganalytics-7.4.1 → posthoganalytics-7.4.2}/posthoganalytics.egg-info/dependency_links.txt +0 -0
  60. {posthoganalytics-7.4.1 → posthoganalytics-7.4.2}/posthoganalytics.egg-info/requires.txt +0 -0
  61. {posthoganalytics-7.4.1 → posthoganalytics-7.4.2}/posthoganalytics.egg-info/top_level.txt +0 -0
  62. {posthoganalytics-7.4.1 → posthoganalytics-7.4.2}/pyproject.toml +0 -0
  63. {posthoganalytics-7.4.1 → posthoganalytics-7.4.2}/setup.cfg +0 -0
  64. {posthoganalytics-7.4.1 → posthoganalytics-7.4.2}/setup.py +0 -0
  65. {posthoganalytics-7.4.1 → posthoganalytics-7.4.2}/setup_analytics.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: posthoganalytics
3
- Version: 7.4.1
3
+ Version: 7.4.2
4
4
  Summary: Integrate PostHog into any python application.
5
5
  Home-page: https://github.com/posthog/posthog-python
6
6
  Author: Posthog
@@ -1,25 +1,42 @@
1
1
  import datetime # noqa: F401
2
- from typing import Callable, Dict, Optional, Any # noqa: F401
2
+ from typing import Any, Callable, Dict, Optional # noqa: F401
3
+
3
4
  from typing_extensions import Unpack
4
5
 
5
- from posthoganalytics.args import OptionalCaptureArgs, OptionalSetArgs, ExceptionArg
6
+ from posthoganalytics.args import ExceptionArg, OptionalCaptureArgs, OptionalSetArgs
6
7
  from posthoganalytics.client import Client
8
+ from posthoganalytics.contexts import (
9
+ identify_context as inner_identify_context,
10
+ )
7
11
  from posthoganalytics.contexts import (
8
12
  new_context as inner_new_context,
13
+ )
14
+ from posthoganalytics.contexts import (
9
15
  scoped as inner_scoped,
10
- tag as inner_tag,
11
- set_context_session as inner_set_context_session,
12
- identify_context as inner_identify_context,
16
+ )
17
+ from posthoganalytics.contexts import (
13
18
  set_capture_exception_code_variables_context as inner_set_capture_exception_code_variables_context,
14
- set_code_variables_mask_patterns_context as inner_set_code_variables_mask_patterns_context,
19
+ )
20
+ from posthoganalytics.contexts import (
15
21
  set_code_variables_ignore_patterns_context as inner_set_code_variables_ignore_patterns_context,
16
22
  )
23
+ from posthoganalytics.contexts import (
24
+ set_code_variables_mask_patterns_context as inner_set_code_variables_mask_patterns_context,
25
+ )
26
+ from posthoganalytics.contexts import (
27
+ set_context_session as inner_set_context_session,
28
+ )
29
+ from posthoganalytics.contexts import (
30
+ tag as inner_tag,
31
+ )
17
32
  from posthoganalytics.exception_utils import (
18
33
  DEFAULT_CODE_VARIABLES_IGNORE_PATTERNS,
19
34
  DEFAULT_CODE_VARIABLES_MASK_PATTERNS,
20
35
  )
21
36
  from posthoganalytics.feature_flags import (
22
37
  InconclusiveMatchError as InconclusiveMatchError,
38
+ )
39
+ from posthoganalytics.feature_flags import (
23
40
  RequiresServerEvaluation as RequiresServerEvaluation,
24
41
  )
25
42
  from posthoganalytics.flag_definition_cache import (
@@ -35,6 +52,8 @@ from posthoganalytics.request import (
35
52
  from posthoganalytics.types import (
36
53
  FeatureFlag,
37
54
  FlagsAndPayloads,
55
+ )
56
+ from posthoganalytics.types import (
38
57
  FeatureFlagResult as FeatureFlagResult,
39
58
  )
40
59
  from posthoganalytics.version import VERSION
@@ -201,6 +220,7 @@ default_client = None # type: Optional[Client]
201
220
  capture_exception_code_variables = False
202
221
  code_variables_mask_patterns = DEFAULT_CODE_VARIABLES_MASK_PATTERNS
203
222
  code_variables_ignore_patterns = DEFAULT_CODE_VARIABLES_IGNORE_PATTERNS
223
+ in_app_modules = None # type: Optional[list[str]]
204
224
 
205
225
 
206
226
  # NOTE - this and following functions take unpacked kwargs because we needed to make
@@ -799,6 +819,7 @@ def setup() -> Client:
799
819
  capture_exception_code_variables=capture_exception_code_variables,
800
820
  code_variables_mask_patterns=code_variables_mask_patterns,
801
821
  code_variables_ignore_patterns=code_variables_ignore_patterns,
822
+ in_app_modules=in_app_modules,
802
823
  )
803
824
 
804
825
  # always set incase user changes it
@@ -5,24 +5,33 @@ import sys
5
5
  import warnings
6
6
  from datetime import datetime, timedelta
7
7
  from typing import Any, Dict, Optional, Union
8
- from typing_extensions import Unpack
9
8
  from uuid import uuid4
10
9
 
11
10
  from dateutil.tz import tzutc
12
11
  from six import string_types
12
+ from typing_extensions import Unpack
13
13
 
14
- from posthoganalytics.args import OptionalCaptureArgs, OptionalSetArgs, ID_TYPES, ExceptionArg
14
+ from posthoganalytics.args import ID_TYPES, ExceptionArg, OptionalCaptureArgs, OptionalSetArgs
15
15
  from posthoganalytics.consumer import Consumer
16
+ from posthoganalytics.contexts import (
17
+ _get_current_context,
18
+ get_capture_exception_code_variables_context,
19
+ get_code_variables_ignore_patterns_context,
20
+ get_code_variables_mask_patterns_context,
21
+ get_context_distinct_id,
22
+ get_context_session_id,
23
+ new_context,
24
+ )
16
25
  from posthoganalytics.exception_capture import ExceptionCapture
17
26
  from posthoganalytics.exception_utils import (
27
+ DEFAULT_CODE_VARIABLES_IGNORE_PATTERNS,
28
+ DEFAULT_CODE_VARIABLES_MASK_PATTERNS,
18
29
  exc_info_from_error,
30
+ exception_is_already_captured,
19
31
  exceptions_from_error_tuple,
20
32
  handle_in_app,
21
- exception_is_already_captured,
22
33
  mark_exception_as_captured,
23
34
  try_attach_code_variables_to_frames,
24
- DEFAULT_CODE_VARIABLES_MASK_PATTERNS,
25
- DEFAULT_CODE_VARIABLES_IGNORE_PATTERNS,
26
35
  )
27
36
  from posthoganalytics.feature_flags import (
28
37
  InconclusiveMatchError,
@@ -46,15 +55,6 @@ from posthoganalytics.request import (
46
55
  get,
47
56
  remote_config,
48
57
  )
49
- from posthoganalytics.contexts import (
50
- _get_current_context,
51
- get_context_distinct_id,
52
- get_context_session_id,
53
- get_capture_exception_code_variables_context,
54
- get_code_variables_mask_patterns_context,
55
- get_code_variables_ignore_patterns_context,
56
- new_context,
57
- )
58
58
  from posthoganalytics.types import (
59
59
  FeatureFlag,
60
60
  FeatureFlagError,
@@ -197,6 +197,7 @@ class Client(object):
197
197
  capture_exception_code_variables=False,
198
198
  code_variables_mask_patterns=None,
199
199
  code_variables_ignore_patterns=None,
200
+ in_app_modules: list[str] | None = None,
200
201
  ):
201
202
  """
202
203
  Initialize a new PostHog client instance.
@@ -265,6 +266,7 @@ class Client(object):
265
266
  if code_variables_ignore_patterns is not None
266
267
  else DEFAULT_CODE_VARIABLES_IGNORE_PATTERNS
267
268
  )
269
+ self.in_app_modules = in_app_modules
268
270
 
269
271
  if project_root is None:
270
272
  try:
@@ -998,6 +1000,7 @@ class Client(object):
998
1000
  "values": all_exceptions_with_trace,
999
1001
  },
1000
1002
  },
1003
+ in_app_include=self.in_app_modules,
1001
1004
  project_root=self.project_root,
1002
1005
  )
1003
1006
  all_exceptions_with_trace_and_in_app = event["exception"]["values"]
@@ -2182,9 +2185,9 @@ class Client(object):
2182
2185
  return None
2183
2186
 
2184
2187
  try:
2185
- from urllib.parse import urlparse, parse_qs
2188
+ from urllib.parse import parse_qs, urlparse
2186
2189
  except ImportError:
2187
- from urlparse import urlparse, parse_qs
2190
+ from urlparse import parse_qs, urlparse
2188
2191
 
2189
2192
  try:
2190
2193
  parsed = urlparse(cache_url)
@@ -14,23 +14,23 @@ import types
14
14
  from datetime import datetime
15
15
  from types import FrameType, TracebackType # noqa: F401
16
16
  from typing import ( # noqa: F401
17
+ TYPE_CHECKING,
17
18
  Any,
18
19
  Dict,
19
20
  Iterator,
20
21
  List,
21
22
  Literal,
22
23
  Optional,
24
+ Pattern,
23
25
  Set,
24
26
  Tuple,
25
27
  TypedDict,
26
28
  TypeVar,
27
29
  Union,
28
30
  cast,
29
- TYPE_CHECKING,
30
- Pattern,
31
31
  )
32
32
 
33
- from posthoganalytics.args import ExcInfo, ExceptionArg # noqa: F401
33
+ from posthoganalytics.args import ExceptionArg, ExcInfo # noqa: F401
34
34
 
35
35
  try:
36
36
  # Python 3.11
@@ -1,4 +1,4 @@
1
- VERSION = "7.4.1"
1
+ VERSION = "7.4.2"
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: 7.4.1
3
+ Version: 7.4.2
4
4
  Summary: Integrate PostHog into any python application.
5
5
  Home-page: https://github.com/posthog/posthog-python
6
6
  Author: Posthog