Repository navigation
v0.2.3
Patch release: report links (create, resolve, and run a Mixpanel report URL from headless params), MP_API_BASE_URL single-host routing, a limit= parameter plus run_*_params on the query methods, Filter operator validation on direct construction, a CLI exit-code change for BookmarkValidationError, and the plugin manifest catches up to the library version.
Added
MP_API_BASE_URL— route every API family at one alternate host. When set (trailing slash tolerated; read per request, not at import), the per-regionENDPOINTSlookup is bypassed and the four families resolve to path prefixes on that single base:query→{base}/api/query,export→{base}/api/2.0,engage→{base}/api/query/engage,app→{base}/api/app. ThempCLI inherits it with no flag. App-vs-Query timeout selection and pinnedworkspace_idinjection key off the family, so they behave identically under the override.mp login's region probe collapses to one probe at the base (region label fromMP_REGIONwhen valid, elseus). Plainhttp://bases are accepted and intended for local / headless deployments only.MP_REGIONremains required and meaningful for non-URL uses. OptionalMP_APP_BASE_URLre-homes only the App API family at{app_base}/api/app. With both unset, behaviour is byte-identical to before. (#235)limit=on the query methods, plusrun_*_params.query(),query_funnel(), andquery_retention()acceptlimit=(1 to 50000, default 3000) to raise the segment cap for high-cardinality breakdowns; checkresult.meta["is_segmentation_limit_hit"]to see whether the result was still truncated. Newrun_params(),run_funnel_params(),run_retention_params(),run_flow_params(), andrun_user_params()execute a params dict that the matchingbuild_*_params()produced (or one written by hand) and return the same result type as the typed query method, so params the typed builder cannot express can still run. (#225)- Report links (045, AIE-561 / AIE-562, #223). Share a headless query as a Mixpanel report URL and resolve a report URL back into runnable params.
Workspace.create_report_link(params_or_result, *, report_type=, name=, description=, workspace_id=, bookmark_id=, validate=)stores an unsaved report under a 12-character slug and returns aReportLink.Workspace.resolve_report_link(link)accepts a full URL, a bare slug, or ahttps://mixpanel.com/s/{code}shortlink and returns aResolvedReportwith the raw params. A region mismatch fails before any HTTP call; project and pinned-workspace mismatches fail before the record fetch.Workspace.query_report_link(link_or_resolved, *, mode=)runs the params throughquery/query_funnel/query_retention/query_flow, under exactly the scope the report records (the URLwid, else the pin at resolve time, else project-wide); the current pin is never injected, so a pin cleared or set after resolve time cannot change the data view. AResolvedReportwhose recorded region or project differs from the active session, or whose recorded workspace differs from the pinned session workspace, is rejected before any query. The fourLiveQueryServiceinline methods andMixpanelAPIClient.insights_query/arb_funnels_queryaccept an optionalworkspace_idthat wins over the pin, andinject_workspace_id=Falseto run project-wide.Workspace.saved_report_link(bookmark_id, *, report_type=, workspace_id=)builds a saved-report URL with no network call.- CLI:
mp reports linkandmp reports resolve [--run] [--mode], plus an opt-in--linkflag onmp query segmentation,funnel,saved-report, andflowsthat addsreport_urlto the output. A link failure never fails the query:report_urlisnullandreport_url_errorholds the reason. - Types:
ReportLinkType,BookmarkUrl,ReportLink,ResolvedReport,ReportLinkQueryResult. - Exceptions:
ReportLinkErrorand its subclassesReportLinkParseError,UnsupportedReportLinkError,ReportLinkNotFoundError,ReportLinkScopeMismatchError,ShortLinkResolutionError; every instance carries ahintindetails. Builder and input guard codesRL1_UNKNOWN_REPORT_TYPE,RL2_INVALID_SLUG,RL3_UNKNOWN_REGION,RL4_REPORT_TYPE_CONFLICT,RL5_RESOLVED_REPORT_INCONSISTENT,RL6_INVALID_ID(raised asParamValidationError). - CLI exit codes:
ReportLinkNotFoundError→ 4;ReportLinkParseError,UnsupportedReportLinkError, andReportLinkScopeMismatchError→ 3;ShortLinkResolutionError→ 1. The CLI printsdetails["hint"]on ahint:line for all of them.
Changed
BookmarkValidationErrornow exits the CLI with code 3, not 1. The class is raised by about 15 pre-existing commands (mp reports create,mp reports update, the dashboard verbs, and others) when params fail the client-side schema check.handle_errorsnow printserror: params failed schema validationplus one line perseverity="error"item and exits withINVALID_ARGS(3). Scripts that test for exit code 1 on those commands must be updated. (#223)- Plugin: the manifest version is now
0.2.3, in step with the library. It stayed at0.2.1through the0.2.2release.
Fixed
Filter(...)built positionally no longer serializes an unvalidated operator.Filter("gold", "greater_than", 10, "number")used to emit"filterOperator": "greater_than"verbatim and fail server-side with HTTP 400 (Unsupported operator for filter_type number).Filter.__post_init__now validates_operatoragainst theFilterOperatorliteral and raisesValueErrorimmediately — naming the bad operator, listing the valid wire operators, and pointing at the factory methods — instead of surfacing a genericQueryErrorone HTTP round trip later. The factory-method spellings are accepted as aliases and normalized to the wire operator ("greater_than"→"is greater than","is_set"→"is set","not_between"→"not between","in_the_last"→"was in the", and so on for every publicFilterclassmethod), so the positional call now produces byte-identical output to the equivalent factory. The two segmentation-wherespellings that pre-date the literal,"is equal to"and"between", stay constructible as aliases of"equals"and"is between"(same==/><segfilter output). On abooleanproperty,equals/does not equalwith aTrue/Falsevalue collapse totrue/falsewithfilterValue: null, matchingFilter.is_true()/Filter.is_false(); any other operator on a boolean property is rejected, andtrue/false(however spelled) reject any non-Nonevalue. A booleanInlineCustomPropertyis governed by the same rules (the inline type wins, as inbuild_filter_entry). Non-string operators raise the sameValueErrorrather thanTypeError. The_operatorfield is typed as the newFilterOperatorInputliteral (wire operators plus aliases) so the positional call type-checks; the stored value is always canonical. Already-valid input is never rewritten. TheFilterdocstring no longer claims the class is "never instantiated directly". (#236)
Documentation
FrequencyFilternow documents that the query engine evaluates its threshold per query time bucket (unit), not over the whole report date range. With the defaultunit="day",FrequencyFilter("Login", value=5)keeps only users who logged in 5+ times on a single day and returns an empty series when nobody does, even if thousands did so across the month; choose theunitthat matches the threshold period ("month"for "N times in a month"). TheWorkspace.query(where=...)docstring, the query guide, and the mixpanelyst skill carry the same warning. Thedate_range_value/date_range_unitparameters are documented as having no observable effect on inline insights filters in a 2026-09-11 probe (unverified against platform fixtures); they are unchanged on the wire. (#234)- Plugin: dead reference links in the setup skill are fixed. (#230)
Full Changelog: v0.2.2...v0.2.3