diff --git a/CHANGELOG.md b/CHANGELOG.md index 5f025b18..84d59764 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,11 +1,16 @@ +## 4.3.3 - 2025-06-06 + +Add `setup()` function to initialise default client + ## 4.3.2 - 2025-06-06 Add context management: - - New context manager with `posthog.new_context()` - - Tag functions: `posthog.tag()`, `posthog.get_tags()`, `posthog.clear_tags()` - - Function decorator: - - `@posthog.scoped` - Creates context and captures exceptions thrown within the function - - Automatic deduplication of exceptions to ensure each exception is only captured once + +- New context manager with `posthog.new_context()` +- Tag functions: `posthog.tag()`, `posthog.get_tags()`, `posthog.clear_tags()` +- Function decorator: + - `@posthog.scoped` - Creates context and captures exceptions thrown within the function +- Automatic deduplication of exceptions to ensure each exception is only captured once ## 4.2.1 - 2025-6-05 diff --git a/posthog/__init__.py b/posthog/__init__.py index 3b69182b..6a520dcf 100644 --- a/posthog/__init__.py +++ b/posthog/__init__.py @@ -580,8 +580,7 @@ def shutdown(): _proxy("join") -def _proxy(method, *args, **kwargs): - """Create an analytics client if one doesn't exist and send to it.""" +def setup(): global default_client if not default_client: default_client = Client( @@ -610,6 +609,11 @@ def _proxy(method, *args, **kwargs): default_client.disabled = disabled default_client.debug = debug + +def _proxy(method, *args, **kwargs): + """Create an analytics client if one doesn't exist and send to it.""" + setup() + fn = getattr(default_client, method) return fn(*args, **kwargs) diff --git a/posthog/version.py b/posthog/version.py index 223ba835..e5384a2b 100644 --- a/posthog/version.py +++ b/posthog/version.py @@ -1,4 +1,4 @@ -VERSION = "4.3.2" +VERSION = "4.3.3" if __name__ == "__main__": print(VERSION, end="") # noqa: T201