Repository navigation
feat!: remove capture v0 and legacy transport options - #1018
Conversation
posthog-python Compliance ReportDate: 2026-10-10T22:43:11.175948+00:00 ✅ All Tests Passed!116/116 tests passed Capture_V1 Tests✅ 95/95 tests passed View Details
Feature_Flags Tests✅ 17/17 tests passed View Details
Feature_Flags_Local_Evaluation Tests✅ 4/4 tests passed View Details
|
|
@greptileai review |
PR overviewAll previously flagged issues have been addressed. No open security concerns remain on this pull request. Security reviewNo open security issues remain on this pull request. Fixed/addressed: 1 · PR risk: 0/10 |
|
Capture v1 is the only capture path. Remove CaptureMode, the capture_mode kwarg and POSTHOG_CAPTURE_MODE, the gzip kwarg, request.batch_post and the v0 endpoint constants, and the backoff dependency. Client and AsyncPosthog constructors are keyword-only after host.
660c865 to
f309e30
Compare
💡 Motivation and Context
Second PR in the capture v1 series, stacked on #1017. Capture v1 becomes the only capture path, and the v0 transport is removed.
Breaking removals:
CaptureMode, thecapture_modekwarg, and thePOSTHOG_CAPTURE_MODEenv var. This followsposthog-go'sv1branch, which removed its capture mode switch too.gzipkwarg onClient/AsyncPosthog/Consumer. Usecapture_compressioninstead (default none, env varPOSTHOG_CAPTURE_COMPRESSIONstill honored).request.batch_post,EVENTS_ENDPOINT,AI_EVENTS_ENDPOINT, and the asyncasync_batch_post.gzipparameter ofrequest.postandrequest.flags. No caller passed it, and flags requests were never gzipped by the client, so flags behavior does not change.backoffdependency.ClientandAsyncPosthogconstructors are keyword-only afterhost.Other changes:
/i/v1/ai/events, uncompressed.AsyncPosthogcapture no longer needshttpx. The httpx client is now only built for flags and remote config.legacy_event_family.jsonis renamed toevent_family.json.capture_v1). The adapter drops its v0batch_postpatching.Things to review:
options: {}on every event. This shows in the regenerated snapshots. The event options PR later in the series revisits it.requestsin a thread, which matches the v1 behavior users already had when opted in.No new changeset: the major changeset on
v1already covers v0 removal. The migration guide PR lists each breaking change.💚 How did you test it?
pytestsuite,ruff format --check,ruff check,mypywith the baseline filter,python -W error -c "import posthog", the public API snapshot check, the adapter tests, anduv lock --check, all locally.test_capture_v1.py(retries,Retry-After, 408, terminal errors).test_ai_capture_lane.pynow asserts that the AI lane keeps its own path and no compression while analytics usescapture_compression="gzip", in both async andsync_mode.📝 Checklist
If releasing new changes
sampo addto generate a changeset file🤖 Agent context
Autonomy: Human-driven (agent-assisted)
Written with Cursor (Claude Opus) under the direction of the assignee. Removing
CaptureModeoutright (rather than keeping a v1-only enum), collapsing the compliance job, and droppinggzipfromrequest.post/request.flagswere agent calls made to matchposthog-go'sv1branch; flag them if you want them kept.