: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.
Python ab-testingai-analyticsanalyticscdpdata-warehouseexperimentsfeature-flagsjavascriptproduct-analyticspythonreactsession-replaysurveystypescriptweb-analytics
#!/usr/bin/env python
import os
import sys
import subprocess
# Add the project root to Python path
sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
from posthog.schema_migrations import LATEST_VERSIONS, _discover_migrations
from posthog.utils import to_json
# Ensure migrations are discovered before accessing LATEST_VERSIONS
_discover_migrations()
filename = "frontend/src/queries/schema/latest-versions.json"
# Make LATEST_VERSIONS accessible frontend-side
with open(filename, "wb") as f:
with_comment = {
"//": "THIS FILE IS AUTOGENERATED. DO NOT EDIT MANUALLY. To update: pnpm run schema:build",
**LATEST_VERSIONS, # Unpack the dictionary to include its contents
}
f.write(to_json(with_comment))
subprocess.run(
["pnpm", "exec", "oxfmt", filename],
)