Skip to content

Commit e480b88

Browse files
fix: Move code under mypy type (#188)
* fix: Move code under mypy type This is incorrect, we should've added these slightly lower in the method definition to avoid mypy from breaking * feat: Bump to 3.12.1
1 parent 3ff2a85 commit e480b88

File tree

3 files changed

+64
-41
lines changed

3 files changed

+64
-41
lines changed

CHANGELOG.md

+7
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
1+
## 3.12.1 - 2025-02-11
2+
3+
1. Fix mypy support for 3.12.0
4+
2. Deprecate `is_simple_flag`
5+
16
## 3.12.0 - 2025-02-11
27

38
1. Add support for OpenAI beta parse API.
9+
2. Deprecate `context` parameter
410

511
## 3.11.1 - 2025-02-06
612

@@ -9,6 +15,7 @@
915
## 3.11.0 - 2025-01-28
1016

1117
1. Add the `$ai_span` event to the LangChain callback handler to capture the input and output of intermediary chains.
18+
1219
> LLM observability naming change: event property `$ai_trace_name` is now `$ai_span_name`.
1320
1421
2. Fix serialiazation of Pydantic models in methods.

posthog/__init__.py

+56-40
Original file line numberDiff line numberDiff line change
@@ -44,13 +44,6 @@ def capture(
4444
send_feature_flags=False,
4545
disable_geoip=None, # type: Optional[bool]
4646
):
47-
if context is not None:
48-
warnings.warn(
49-
"The 'context' parameter is deprecated and will be removed in a future version.",
50-
DeprecationWarning,
51-
stacklevel=2,
52-
)
53-
5447
# type: (...) -> Tuple[bool, dict]
5548
"""
5649
Capture allows you to capture anything a user does within your system, which you can later use in PostHog to find patterns in usage, work out which features to improve or where people are giving up.
@@ -72,6 +65,14 @@ def capture(
7265
posthog.capture('distinct id', 'purchase', groups={'company': 'id:5'})
7366
```
7467
"""
68+
69+
if context is not None:
70+
warnings.warn(
71+
"The 'context' parameter is deprecated and will be removed in a future version.",
72+
DeprecationWarning,
73+
stacklevel=2,
74+
)
75+
7576
return _proxy(
7677
"capture",
7778
distinct_id=distinct_id,
@@ -94,13 +95,6 @@ def identify(
9495
uuid=None, # type: Optional[str]
9596
disable_geoip=None, # type: Optional[bool]
9697
):
97-
if context is not None:
98-
warnings.warn(
99-
"The 'context' parameter is deprecated and will be removed in a future version.",
100-
DeprecationWarning,
101-
stacklevel=2,
102-
)
103-
10498
# type: (...) -> Tuple[bool, dict]
10599
"""
106100
Identify lets you add metadata on your users so you can more easily identify who they are in PostHog, and even do things like segment users by these properties.
@@ -117,6 +111,14 @@ def identify(
117111
})
118112
```
119113
"""
114+
115+
if context is not None:
116+
warnings.warn(
117+
"The 'context' parameter is deprecated and will be removed in a future version.",
118+
DeprecationWarning,
119+
stacklevel=2,
120+
)
121+
120122
return _proxy(
121123
"identify",
122124
distinct_id=distinct_id,
@@ -136,13 +138,6 @@ def set(
136138
uuid=None, # type: Optional[str]
137139
disable_geoip=None, # type: Optional[bool]
138140
):
139-
if context is not None:
140-
warnings.warn(
141-
"The 'context' parameter is deprecated and will be removed in a future version.",
142-
DeprecationWarning,
143-
stacklevel=2,
144-
)
145-
146141
# type: (...) -> Tuple[bool, dict]
147142
"""
148143
Set properties on a user record.
@@ -159,6 +154,14 @@ def set(
159154
})
160155
```
161156
"""
157+
158+
if context is not None:
159+
warnings.warn(
160+
"The 'context' parameter is deprecated and will be removed in a future version.",
161+
DeprecationWarning,
162+
stacklevel=2,
163+
)
164+
162165
return _proxy(
163166
"set",
164167
distinct_id=distinct_id,
@@ -178,13 +181,6 @@ def set_once(
178181
uuid=None, # type: Optional[str]
179182
disable_geoip=None, # type: Optional[bool]
180183
):
181-
if context is not None:
182-
warnings.warn(
183-
"The 'context' parameter is deprecated and will be removed in a future version.",
184-
DeprecationWarning,
185-
stacklevel=2,
186-
)
187-
188184
# type: (...) -> Tuple[bool, dict]
189185
"""
190186
Set properties on a user record, only if they do not yet exist.
@@ -201,6 +197,14 @@ def set_once(
201197
})
202198
```
203199
"""
200+
201+
if context is not None:
202+
warnings.warn(
203+
"The 'context' parameter is deprecated and will be removed in a future version.",
204+
DeprecationWarning,
205+
stacklevel=2,
206+
)
207+
204208
return _proxy(
205209
"set_once",
206210
distinct_id=distinct_id,
@@ -221,12 +225,6 @@ def group_identify(
221225
uuid=None, # type: Optional[str]
222226
disable_geoip=None, # type: Optional[bool]
223227
):
224-
if context is not None:
225-
warnings.warn(
226-
"The 'context' parameter is deprecated and will be removed in a future version.",
227-
DeprecationWarning,
228-
stacklevel=2,
229-
)
230228
# type: (...) -> Tuple[bool, dict]
231229
"""
232230
Set properties on a group
@@ -243,6 +241,14 @@ def group_identify(
243241
})
244242
```
245243
"""
244+
245+
if context is not None:
246+
warnings.warn(
247+
"The 'context' parameter is deprecated and will be removed in a future version.",
248+
DeprecationWarning,
249+
stacklevel=2,
250+
)
251+
246252
return _proxy(
247253
"group_identify",
248254
group_type=group_type,
@@ -263,12 +269,6 @@ def alias(
263269
uuid=None, # type: Optional[str]
264270
disable_geoip=None, # type: Optional[bool]
265271
):
266-
if context is not None:
267-
warnings.warn(
268-
"The 'context' parameter is deprecated and will be removed in a future version.",
269-
DeprecationWarning,
270-
stacklevel=2,
271-
)
272272
# type: (...) -> Tuple[bool, dict]
273273
"""
274274
To marry up whatever a user does before they sign up or log in with what they do after you need to make an alias call. This will allow you to answer questions like "Which marketing channels leads to users churning after a month?" or "What do users do on our website before signing up?"
@@ -286,6 +286,14 @@ def alias(
286286
posthog.alias('anonymous session id', 'distinct id')
287287
```
288288
"""
289+
290+
if context is not None:
291+
warnings.warn(
292+
"The 'context' parameter is deprecated and will be removed in a future version.",
293+
DeprecationWarning,
294+
stacklevel=2,
295+
)
296+
289297
return _proxy(
290298
"alias",
291299
previous_id=previous_id,
@@ -329,6 +337,14 @@ def capture_exception(
329337
330338
```
331339
"""
340+
341+
if context is not None:
342+
warnings.warn(
343+
"The 'context' parameter is deprecated and will be removed in a future version.",
344+
DeprecationWarning,
345+
stacklevel=2,
346+
)
347+
332348
return _proxy(
333349
"capture_exception",
334350
exception=exception,

posthog/version.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
VERSION = "3.12.0"
1+
VERSION = "3.12.1"
22

33
if __name__ == "__main__":
44
print(VERSION, end="") # noqa: T201

0 commit comments

Comments
 (0)