Skip to content

:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.

fix(ci): Lazy-load STPyV8 import in helpers.py (#60133)

mendral-app[bot]ab03b8e6bacb
diff --git a/posthog/cdp/templates/helpers.py b/posthog/cdp/templates/helpers.py
index 034b28db96e4..f407d6035610 100644
--- a/posthog/cdp/templates/helpers.py
+++ b/posthog/cdp/templates/helpers.py
@@ -6,8 +6,6 @@ from typing import Any, Optional, cast
from posthog.test.base import APIBaseTest, BaseTest
from unittest.mock import MagicMock, patch
-import STPyV8
-
from posthog.cdp.site_functions import get_transpiled_function
from posthog.cdp.templates.hog_function_template import HogFunctionTemplateDC, sync_template_to_db
from posthog.cdp.validation import compile_hog
@@ -243,6 +241,8 @@ class BaseSiteDestinationFunctionTest(APIBaseTest):
processEvent(globals, posthog);;
"""
+ import STPyV8
+
with STPyV8.JSContext() as ctxt:
ctxt.eval(js)
calls_json = ctxt.eval(