Built-in Help¶
mixpanel_headless.help() prints reference text for any public name. mixpanel_headless.reference returns the same information as structured, frozen dataclasses. Both work offline: no network call, no config file, no Workspace. See the Built-in Help guide for the query grammar, the three output formats, the JSON shape, the exit codes, and the mp help CLI command.
import mixpanel_headless as mp
from mixpanel_headless import reference as ref
mp.help("Workspace.query") # prints text, returns None
entry = ref.describe("Workspace.query_funnel") # HelpEntry
hits = ref.search("retention") # SearchResult
print(ref.render(entry, "markdown"))
Import with an alias
from mixpanel_headless import help shadows the Python builtin in that namespace. Prefer import mixpanel_headless as mp and mp.help(...).
mixpanel_headless.reference¶
mixpanel_headless.reference
¶
Built-in API reference: help(), describe(), search(), render().
This module is the public face of the offline help system. It
introspects the installed mixpanel_headless package and answers questions
about its own surface — signatures, fields, enum values, Literal aliases,
exception trees, Workspace domains — without a network call, without a
config file, and without building a Workspace.
Three ways to use it:
import mixpanel_headless as mp
mp.help("Workspace.query") # print reference text
entry = mp.reference.describe("Filter") # structured HelpEntry
hits = mp.reference.search("cohort") # structured SearchResult
The CLI twin is mp help QUERY... (also python3 -m mixpanel_headless
help QUERY...).
Importing this module is cheap: the introspection machinery loads lazily on
the first call, so import mixpanel_headless does not pay for it.
HelpFormat
module-attribute
¶
Output format accepted by the renderers and the CLI --format option.
HelpKind
module-attribute
¶
Classification of a help entry (what kind of object the query resolved to).
Every MemberKind plus the three kinds that only exist as whole entries:
the package overview, a listing (Workspace, types,
exceptions), and a single parameter of a callable. A search result
is a SearchResult, not a HelpEntry, and has no kind.
DocSections
dataclass
¶
DocSections(
summary: str = "",
body: str = "",
args: tuple[tuple[str, str], ...] = (),
returns: str = "",
raises: tuple[tuple[str, str], ...] = (),
example: str = "",
notes: str = "",
)
Parsed Google-style docstring.
| ATTRIBUTE | DESCRIPTION |
|---|---|
summary |
First paragraph before the first section header, lines joined with single spaces.
TYPE:
|
body |
Everything before the first section header, dedented, newlines kept.
TYPE:
|
args |
TYPE:
|
returns |
Text of
TYPE:
|
raises |
TYPE:
|
example |
Text of
TYPE:
|
notes |
Text of
TYPE:
|
to_dict
¶
Convert to a JSON-serializable dict.
| RETURNS | DESCRIPTION |
|---|---|
dict[str, object]
|
A dict with |
Source code in src/mixpanel_headless/_internal/help/models.py
FieldDoc
dataclass
¶
FieldDoc(
name: str,
annotation: str,
default: str | None = None,
required: bool = False,
constraints: tuple[str, ...] = (),
alias: str | None = None,
values: tuple[str, ...] = (),
description: str = "",
)
One public field of a dataclass or Pydantic model.
| ATTRIBUTE | DESCRIPTION |
|---|---|
name |
Python attribute name.
TYPE:
|
annotation |
Display form of the annotation.
TYPE:
|
default |
Display form of the default (
TYPE:
|
required |
TYPE:
|
constraints |
Pydantic constraints such as
TYPE:
|
alias |
JSON alias when it differs from
TYPE:
|
values |
Enum member names or literal values accepted by the field, if any.
TYPE:
|
description |
Field description from
TYPE:
|
__post_init__
¶
Reject a required field that also carries a default.
| RAISES | DESCRIPTION |
|---|---|
ValueError
|
When |
Source code in src/mixpanel_headless/_internal/help/models.py
to_dict
¶
Convert to a JSON-serializable dict.
| RETURNS | DESCRIPTION |
|---|---|
dict[str, object]
|
A dict with every field; tuples become lists. |
Source code in src/mixpanel_headless/_internal/help/models.py
Group
dataclass
¶
A titled group of members, used for Workspace domain grouping.
| ATTRIBUTE | DESCRIPTION |
|---|---|
title |
Group title, for example
TYPE:
|
items |
Members in the group.
TYPE:
|
to_dict
¶
Convert to a JSON-serializable dict.
| RETURNS | DESCRIPTION |
|---|---|
dict[str, object]
|
|
Source code in src/mixpanel_headless/_internal/help/models.py
HelpEntry
dataclass
¶
HelpEntry(
kind: HelpKind,
name: str,
qualname: str,
summary: str,
doc: DocSections,
signature: SignatureDoc | None = None,
bases: tuple[str, ...] = (),
config: tuple[tuple[str, str], ...] = (),
construction: tuple[MemberDoc, ...] = (),
fields: tuple[FieldDoc, ...] = (),
properties: tuple[MemberDoc, ...] = (),
methods: tuple[MemberDoc, ...] = (),
values: tuple[str, ...] = (),
value: str | None = None,
groups: tuple[Group, ...] = (),
referenced_types: tuple[tuple[str, str], ...] = (),
used_by: tuple[UsageDoc, ...] = (),
domain: str | None = None,
see_also: tuple[str, ...] = (),
hints: tuple[Hint, ...] = (),
)
Structured description of one resolved help query.
kind, name, qualname, summary, and doc are required.
Every collection defaults to an empty tuple and every scalar extra to
None, so builders can construct partial entries for kinds that lack
a section. Which fields a kind populates is fixed by the conventions
below; reference.describe() follows them and the renderers rely on
them. A consumer of to_dict() can too.
Per-kind field conventions:
method/function:signatureholds the callable andnameis the display name (Workspace.query,accounts.add).referenced_typeslists the library types in the signature. For aWorkspacemethod,domainis the registry domain title andsee_alsonames the otherWorkspacemethods of that domain; both are empty for every other callable.groupsis unused.property:signaturehas no params; itsreturnsis the property type orNone.parameter:signature.paramsholds exactly oneParamDocandsignature.nameis the owning callable's bare name;valuesrepeats the parameter's allowed values;summaryanddoccarry the parameter description.class/model/dataclass:bases,config(models only),construction,fields(models and dataclasses),properties,methods, andused_bymap one-to-one to the rendered sections.enum:valuesholds the member names in definition order andfieldsreusesFieldDocfor the members:nameis the member name,annotationthe type name of the member value,defaultitsrepr,requiredalwaysFalse.baseslists the enum's bases.literal:valuesholds the allowed values in declaration order.alias:valuesholds the member display names of the union andreferenced_typesthe(name, summary)rows for the members that are library types.exception:bases[0]is the direct base.groupsis empty for a leaf or one group titledSubclasseswhose items carry their nesting inMemberDoc.depth(a direct subclass is depth0).used_bylists theWorkspacemethods whoseRaises:names it.module: one group titledMemberswith every__all__name.constant:valueis thereprof the value andbasesholds one name, the value's type (the enum class for an enum member such asFeatureFlagStatus.ENABLED).valuesis unused.listing:groupscarries the rows (Workspacedomains, thetypeskinds, or the oneExceptionstree whose items carrydepth).summaryis a count line or the facade's summary.overview:summaryis the package version anddoc.bodythe query grammar;groupsis empty.
| ATTRIBUTE | DESCRIPTION |
|---|---|
kind |
What the query resolved to.
TYPE:
|
name |
Display name, for example
TYPE:
|
qualname |
Canonical help query for this entry, for example
TYPE:
|
summary |
First docstring line (or generated summary for aliases).
TYPE:
|
doc |
Parsed docstring sections.
TYPE:
|
signature |
Signature for callables, else
TYPE:
|
bases |
Names of public base classes (the value's type for a constant).
TYPE:
|
config |
Non-default Pydantic model config as
TYPE:
|
construction |
Public constructors and factory classmethods.
TYPE:
|
fields |
Public dataclass or model fields; enum members for an enum.
TYPE:
|
properties |
Public properties.
TYPE:
|
methods |
Public methods (instance, class, static).
TYPE:
|
values |
Enum member names, literal values, or alias member names.
TYPE:
|
value |
Display form of a constant's value (
TYPE:
|
groups |
Titled member groups for listings, modules, and exception trees.
TYPE:
|
referenced_types |
TYPE:
|
used_by |
TYPE:
|
domain |
Registry domain title of a
TYPE:
|
see_also |
Other
TYPE:
|
hints |
Hosted-documentation pointers.
TYPE:
|
to_dict
¶
Convert to a JSON-serializable dict.
Nested models convert recursively; tuples become lists; pair tuples become two-item lists. Keys follow the dataclass field order.
| RETURNS | DESCRIPTION |
|---|---|
dict[str, object]
|
A dict suitable for |
Source code in src/mixpanel_headless/_internal/help/models.py
Hint
dataclass
¶
Pointer to a hosted documentation page.
| ATTRIBUTE | DESCRIPTION |
|---|---|
title |
Short human-readable label, for example
TYPE:
|
url |
Absolute URL of the page.
TYPE:
|
to_dict
¶
Convert to a JSON-serializable dict.
| RETURNS | DESCRIPTION |
|---|---|
dict[str, object]
|
|
MemberDoc
dataclass
¶
MemberDoc(
name: str,
kind: MemberKind,
summary: str = "",
signature: SignatureDoc | None = None,
depth: int = 0,
)
One member in a listing (method, property, classmethod, module export).
| ATTRIBUTE | DESCRIPTION |
|---|---|
name |
Member name, never indented; nesting is carried by
TYPE:
|
kind |
Member classification, one of
TYPE:
|
summary |
First docstring line, or
TYPE:
|
signature |
Signature for
TYPE:
|
depth |
Nesting level inside a tree-shaped group,
TYPE:
|
__post_init__
¶
Validate the kind, its agreement with signature, and depth.
| RAISES | DESCRIPTION |
|---|---|
ValueError
|
When |
Source code in src/mixpanel_headless/_internal/help/models.py
to_dict
¶
Convert to a JSON-serializable dict.
| RETURNS | DESCRIPTION |
|---|---|
dict[str, object]
|
A dict with |
dict[str, object]
|
|
Source code in src/mixpanel_headless/_internal/help/models.py
ParamDoc
dataclass
¶
ParamDoc(
name: str,
annotation: str | None = None,
default: str | None = None,
description: str = "",
values: tuple[str, ...] = (),
kind: ParamKind = "positional_or_keyword",
)
One parameter of a callable signature.
| ATTRIBUTE | DESCRIPTION |
|---|---|
name |
Parameter name without
TYPE:
|
annotation |
Display form of the annotation (already cleaned), or
TYPE:
|
default |
TYPE:
|
description |
Description from the
TYPE:
|
values |
Literal or enum member values accepted by the parameter, if any.
TYPE:
|
kind |
How the parameter may be passed. Renderers print a bare
TYPE:
|
to_dict
¶
Convert to a JSON-serializable dict.
| RETURNS | DESCRIPTION |
|---|---|
dict[str, object]
|
A dict with every field; |
Source code in src/mixpanel_headless/_internal/help/models.py
SearchHit
dataclass
¶
One search result row.
| ATTRIBUTE | DESCRIPTION |
|---|---|
category |
Display category: the
TYPE:
|
name |
Matched name, qualified for
TYPE:
|
summary |
First docstring line, or
TYPE:
|
matched_on |
Which part of the entry matched the term.
TYPE:
|
to_dict
¶
Convert to a JSON-serializable dict.
| RETURNS | DESCRIPTION |
|---|---|
dict[str, object]
|
A dict with the four scalar fields. |
Source code in src/mixpanel_headless/_internal/help/models.py
SearchResult
dataclass
¶
Result of reference.search(term).
| ATTRIBUTE | DESCRIPTION |
|---|---|
term |
The search term as given.
TYPE:
|
hits |
Matching entries in display order, duplicates removed.
TYPE:
|
suggestions |
"Did you mean?" names when there are no hits.
TYPE:
|
to_dict
¶
Convert to a JSON-serializable dict.
| RETURNS | DESCRIPTION |
|---|---|
dict[str, object]
|
|
Source code in src/mixpanel_headless/_internal/help/models.py
SignatureDoc
dataclass
¶
A callable signature with per-parameter documentation.
| ATTRIBUTE | DESCRIPTION |
|---|---|
name |
Callable name (unqualified).
TYPE:
|
params |
Parameters in declaration order.
TYPE:
|
returns |
Display form of the return annotation, or
TYPE:
|
to_dict
¶
Convert to a JSON-serializable dict.
| RETURNS | DESCRIPTION |
|---|---|
dict[str, object]
|
A dict with |
Source code in src/mixpanel_headless/_internal/help/models.py
UsageDoc
dataclass
¶
One Workspace method that accepts a given type ("Used by Workspace").
| ATTRIBUTE | DESCRIPTION |
|---|---|
method |
Method name on
TYPE:
|
params |
Names of the parameters whose annotation references the type.
TYPE:
|
to_dict
¶
Convert to a JSON-serializable dict.
| RETURNS | DESCRIPTION |
|---|---|
dict[str, object]
|
|
HelpLookupError
¶
Bases: MixpanelHeadlessError
A mixpanel_headless.help() / reference.describe() query matched nothing.
Raised by :func:mixpanel_headless.reference.describe (and re-raised by
:func:mixpanel_headless.reference.search for an empty term) when the
query names no export, no Workspace member, and no parameter. The
lookup is fully offline, so this is never an HTTP failure and the base is
:class:MixpanelHeadlessError, not :class:APIError. The CLI maps it to
ExitCode.NOT_FOUND (4).
The instance carries the structured recovery data the plain-text
help() wrapper prints: close-name suggestions (difflib) and the
first search hits for the same term.
| ATTRIBUTE | DESCRIPTION |
|---|---|
query |
The query string as the caller gave it.
TYPE:
|
suggestions |
Close names in
TYPE:
|
hits |
Search hits (
TYPE:
|
Example
Initialize a help lookup miss.
| PARAMETER | DESCRIPTION |
|---|---|
query
|
The query string that matched nothing.
TYPE:
|
suggestions
|
Close names to offer, most similar first. Stored as
a tuple. Rendered as
TYPE:
|
hits
|
Search hits for the same term. Stored as a tuple and kept
out of the message; the
TYPE:
|
Source code in src/mixpanel_headless/exceptions.py
help
¶
help(
query: str | object | None = None,
*,
format: HelpFormat = "text",
file: TextIO | None = None,
hints: bool = True,
domain: str | None = None,
) -> None
Print reference help for the library, a type, a method, or a search.
Works offline: no credentials, no network, no config file. The text is plain (no Rich markup) so it is safe to paste into a prompt or a file.
Query grammar (tokens are split on whitespace, so "search cohort"
and "search cohort" are equal):
| Query | Result kind | Notes |
|---|---|---|
None or "" |
overview |
Version, import line, entry points, domain table, grammar summary, llms.txt link. |
Workspace |
listing |
Methods grouped by domain; properties first. domain= filters to one group (case-insensitive, unique prefix accepted). |
Workspace.<method> |
method |
Signature, docstring, referenced types, see also, hint. |
Workspace.<property> |
property |
Return annotation and docstring. |
Workspace.<method>.<param> |
parameter |
Annotation, default, allowed values, description. |
<Model> (Pydantic) |
model |
Bases, config, construction, fields, properties, methods, used by, hint. |
<Dataclass> |
dataclass |
Same, with dataclass field rules. |
<Enum> |
enum |
Member table and used by. |
<LiteralAlias> |
literal |
Allowed values, one-line description, used by with parameter names. |
<UnionAlias> / Account |
alias |
Expanded members, each with its first doc line. |
<Exception> |
exception |
Base, docstring, subclasses, Workspace methods that raise it. |
<Class>.<member> |
method / property |
Any public class, not only Workspace. |
<function> |
function |
login_unified, validate_bookmark, label helpers. |
accounts / session / targets |
module |
__all__ members with first doc lines and compact signatures. |
<constant> |
constant |
Value and type. |
types |
listing |
Public types grouped by kind. No hints. |
exceptions |
listing |
Indented tree from MixpanelHeadlessError. No hints. |
search <term> |
search |
Case-insensitive substring search. |
help |
function |
This table. |
| miss | (printed) | No help entry ..., Did you mean? suggestions, first five search hits. |
Objects are accepted too: help(mp.Filter), help(ws.query),
help(mp.accounts).
| PARAMETER | DESCRIPTION |
|---|---|
query
|
Query text, a public object, or
TYPE:
|
format
|
TYPE:
|
file
|
Destination stream; defaults to
TYPE:
|
hints
|
Print the hosted-documentation
TYPE:
|
domain
|
Restrict the
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
None
|
|
| RAISES | DESCRIPTION |
|---|---|
ValueError
|
When |
HelpDomainError
|
When |
Example
Source code in src/mixpanel_headless/reference.py
130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 | |
describe
¶
Resolve a query and assemble its structured HelpEntry.
This is the assembler behind :func:help. It resolves the query (a dotted
string from the package root or a public object), then builds one entry
per HelpKind from signatures, docstrings, fields, relations, and hints.
| PARAMETER | DESCRIPTION |
|---|---|
query
|
Dotted query text (
TYPE:
|
hints
|
Include hosted-documentation hints.
TYPE:
|
domain
|
Restrict the
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
HelpEntry
|
The assembled entry. |
| RAISES | DESCRIPTION |
|---|---|
HelpLookupError
|
When the query matches nothing. The error carries
|
HelpDomainError
|
When the query resolved but |
Example
Source code in src/mixpanel_headless/reference.py
search
¶
Search the public surface for a case-insensitive substring.
Matches names first, then first docstring lines, then enum members and
Literal values. Hits are ordered by tier, then by (category, name).
| PARAMETER | DESCRIPTION |
|---|---|
term
|
Text to look for.
TYPE:
|
limit
|
Keep at most this many hits;
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
SearchResult
|
The search result. On a miss |
SearchResult
|
holds close names. |
| RAISES | DESCRIPTION |
|---|---|
HelpLookupError
|
When |
ValueError
|
When |
Example
Source code in src/mixpanel_headless/reference.py
render
¶
Render an entry or a search result as text, markdown, or JSON.
| PARAMETER | DESCRIPTION |
|---|---|
entry
|
A
TYPE:
|
format
|
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
str
|
The rendered string without a trailing newline. |
| RAISES | DESCRIPTION |
|---|---|
ValueError
|
When |
Source code in src/mixpanel_headless/reference.py
clear_cache
¶
Drop every per-process help cache.
Clears the inventory, resolved type hints, relations (used by, raised by, exception map), and the search index. The next call rebuilds them from the live package.
Source code in src/mixpanel_headless/reference.py
render_miss
¶
Render a lookup miss: the error message, then the first search hits.
Shared by :func:help and the mp help command so both print the
same text for the same miss. Not part of __all__; the public entry
points are :func:help (prints it) and :func:describe (raises the
error it renders).
| PARAMETER | DESCRIPTION |
|---|---|
exc
|
The lookup error raised by :func:
TYPE:
|
format
|
The requested output format.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
str
|
For |
str
|
|
str
|
there are hits, by the search view of the first five. |
Example
Source code in src/mixpanel_headless/reference.py
Result types¶
describe() returns a HelpEntry; search() returns a SearchResult. Every result type is a frozen slots=True dataclass with a recursive to_dict(), and every one is a root export, so mp.HelpEntry, mp.ParamDoc, and the rest work as type hints and as help queries (mp help HelpEntry).
| Type | Role |
|---|---|
HelpEntry |
One resolved query. Its docstring lists which fields each kind fills; domain holds the registry domain title of a Workspace method and value the repr of a constant. |
DocSections |
Parsed Google-style docstring: summary, body, args, returns, raises, example, notes. |
SignatureDoc / ParamDoc |
Callable signature. ParamDoc.kind is one of positional_only, positional_or_keyword, var_positional, keyword_only, var_keyword; annotation is None when the source has none. |
FieldDoc |
One model or dataclass field (also reused for enum members). |
MemberDoc |
One row of a class section or group; depth is the nesting level in an exception subclass tree. |
Group |
A titled list of MemberDoc rows (a Workspace domain, a types kind, a module's members). |
UsageDoc |
One Workspace method that accepts or raises the described type. |
Hint |
One hosted-documentation pointer (title, url). |
SearchResult / SearchHit |
Search output; SearchHit.category is a MemberKind and matched_on is name, doc, or member. |
Three Literal kind families describe the surface. ExportKind names what an export can be (module, exception, enum, model, dataclass, class, literal, alias, function, constant). MemberKind adds method and property. HelpKind adds overview, listing, and parameter and is the type of HelpEntry.kind.
mixpanel_headless.HelpEntry
dataclass
¶
HelpEntry(
kind: HelpKind,
name: str,
qualname: str,
summary: str,
doc: DocSections,
signature: SignatureDoc | None = None,
bases: tuple[str, ...] = (),
config: tuple[tuple[str, str], ...] = (),
construction: tuple[MemberDoc, ...] = (),
fields: tuple[FieldDoc, ...] = (),
properties: tuple[MemberDoc, ...] = (),
methods: tuple[MemberDoc, ...] = (),
values: tuple[str, ...] = (),
value: str | None = None,
groups: tuple[Group, ...] = (),
referenced_types: tuple[tuple[str, str], ...] = (),
used_by: tuple[UsageDoc, ...] = (),
domain: str | None = None,
see_also: tuple[str, ...] = (),
hints: tuple[Hint, ...] = (),
)
Structured description of one resolved help query.
kind, name, qualname, summary, and doc are required.
Every collection defaults to an empty tuple and every scalar extra to
None, so builders can construct partial entries for kinds that lack
a section. Which fields a kind populates is fixed by the conventions
below; reference.describe() follows them and the renderers rely on
them. A consumer of to_dict() can too.
Per-kind field conventions:
method/function:signatureholds the callable andnameis the display name (Workspace.query,accounts.add).referenced_typeslists the library types in the signature. For aWorkspacemethod,domainis the registry domain title andsee_alsonames the otherWorkspacemethods of that domain; both are empty for every other callable.groupsis unused.property:signaturehas no params; itsreturnsis the property type orNone.parameter:signature.paramsholds exactly oneParamDocandsignature.nameis the owning callable's bare name;valuesrepeats the parameter's allowed values;summaryanddoccarry the parameter description.class/model/dataclass:bases,config(models only),construction,fields(models and dataclasses),properties,methods, andused_bymap one-to-one to the rendered sections.enum:valuesholds the member names in definition order andfieldsreusesFieldDocfor the members:nameis the member name,annotationthe type name of the member value,defaultitsrepr,requiredalwaysFalse.baseslists the enum's bases.literal:valuesholds the allowed values in declaration order.alias:valuesholds the member display names of the union andreferenced_typesthe(name, summary)rows for the members that are library types.exception:bases[0]is the direct base.groupsis empty for a leaf or one group titledSubclasseswhose items carry their nesting inMemberDoc.depth(a direct subclass is depth0).used_bylists theWorkspacemethods whoseRaises:names it.module: one group titledMemberswith every__all__name.constant:valueis thereprof the value andbasesholds one name, the value's type (the enum class for an enum member such asFeatureFlagStatus.ENABLED).valuesis unused.listing:groupscarries the rows (Workspacedomains, thetypeskinds, or the oneExceptionstree whose items carrydepth).summaryis a count line or the facade's summary.overview:summaryis the package version anddoc.bodythe query grammar;groupsis empty.
| ATTRIBUTE | DESCRIPTION |
|---|---|
kind |
What the query resolved to.
TYPE:
|
name |
Display name, for example
TYPE:
|
qualname |
Canonical help query for this entry, for example
TYPE:
|
summary |
First docstring line (or generated summary for aliases).
TYPE:
|
doc |
Parsed docstring sections.
TYPE:
|
signature |
Signature for callables, else
TYPE:
|
bases |
Names of public base classes (the value's type for a constant).
TYPE:
|
config |
Non-default Pydantic model config as
TYPE:
|
construction |
Public constructors and factory classmethods.
TYPE:
|
fields |
Public dataclass or model fields; enum members for an enum.
TYPE:
|
properties |
Public properties.
TYPE:
|
methods |
Public methods (instance, class, static).
TYPE:
|
values |
Enum member names, literal values, or alias member names.
TYPE:
|
value |
Display form of a constant's value (
TYPE:
|
groups |
Titled member groups for listings, modules, and exception trees.
TYPE:
|
referenced_types |
TYPE:
|
used_by |
TYPE:
|
domain |
Registry domain title of a
TYPE:
|
see_also |
Other
TYPE:
|
hints |
Hosted-documentation pointers.
TYPE:
|
to_dict
¶
Convert to a JSON-serializable dict.
Nested models convert recursively; tuples become lists; pair tuples become two-item lists. Keys follow the dataclass field order.
| RETURNS | DESCRIPTION |
|---|---|
dict[str, object]
|
A dict suitable for |
Source code in src/mixpanel_headless/_internal/help/models.py
mixpanel_headless.DocSections
dataclass
¶
DocSections(
summary: str = "",
body: str = "",
args: tuple[tuple[str, str], ...] = (),
returns: str = "",
raises: tuple[tuple[str, str], ...] = (),
example: str = "",
notes: str = "",
)
Parsed Google-style docstring.
| ATTRIBUTE | DESCRIPTION |
|---|---|
summary |
First paragraph before the first section header, lines joined with single spaces.
TYPE:
|
body |
Everything before the first section header, dedented, newlines kept.
TYPE:
|
args |
TYPE:
|
returns |
Text of
TYPE:
|
raises |
TYPE:
|
example |
Text of
TYPE:
|
notes |
Text of
TYPE:
|
to_dict
¶
Convert to a JSON-serializable dict.
| RETURNS | DESCRIPTION |
|---|---|
dict[str, object]
|
A dict with |
Source code in src/mixpanel_headless/_internal/help/models.py
mixpanel_headless.SignatureDoc
dataclass
¶
A callable signature with per-parameter documentation.
| ATTRIBUTE | DESCRIPTION |
|---|---|
name |
Callable name (unqualified).
TYPE:
|
params |
Parameters in declaration order.
TYPE:
|
returns |
Display form of the return annotation, or
TYPE:
|
to_dict
¶
Convert to a JSON-serializable dict.
| RETURNS | DESCRIPTION |
|---|---|
dict[str, object]
|
A dict with |
Source code in src/mixpanel_headless/_internal/help/models.py
mixpanel_headless.ParamDoc
dataclass
¶
ParamDoc(
name: str,
annotation: str | None = None,
default: str | None = None,
description: str = "",
values: tuple[str, ...] = (),
kind: ParamKind = "positional_or_keyword",
)
One parameter of a callable signature.
| ATTRIBUTE | DESCRIPTION |
|---|---|
name |
Parameter name without
TYPE:
|
annotation |
Display form of the annotation (already cleaned), or
TYPE:
|
default |
TYPE:
|
description |
Description from the
TYPE:
|
values |
Literal or enum member values accepted by the parameter, if any.
TYPE:
|
kind |
How the parameter may be passed. Renderers print a bare
TYPE:
|
to_dict
¶
Convert to a JSON-serializable dict.
| RETURNS | DESCRIPTION |
|---|---|
dict[str, object]
|
A dict with every field; |
Source code in src/mixpanel_headless/_internal/help/models.py
mixpanel_headless.FieldDoc
dataclass
¶
FieldDoc(
name: str,
annotation: str,
default: str | None = None,
required: bool = False,
constraints: tuple[str, ...] = (),
alias: str | None = None,
values: tuple[str, ...] = (),
description: str = "",
)
One public field of a dataclass or Pydantic model.
| ATTRIBUTE | DESCRIPTION |
|---|---|
name |
Python attribute name.
TYPE:
|
annotation |
Display form of the annotation.
TYPE:
|
default |
Display form of the default (
TYPE:
|
required |
TYPE:
|
constraints |
Pydantic constraints such as
TYPE:
|
alias |
JSON alias when it differs from
TYPE:
|
values |
Enum member names or literal values accepted by the field, if any.
TYPE:
|
description |
Field description from
TYPE:
|
__post_init__
¶
Reject a required field that also carries a default.
| RAISES | DESCRIPTION |
|---|---|
ValueError
|
When |
Source code in src/mixpanel_headless/_internal/help/models.py
to_dict
¶
Convert to a JSON-serializable dict.
| RETURNS | DESCRIPTION |
|---|---|
dict[str, object]
|
A dict with every field; tuples become lists. |
Source code in src/mixpanel_headless/_internal/help/models.py
mixpanel_headless.MemberDoc
dataclass
¶
MemberDoc(
name: str,
kind: MemberKind,
summary: str = "",
signature: SignatureDoc | None = None,
depth: int = 0,
)
One member in a listing (method, property, classmethod, module export).
| ATTRIBUTE | DESCRIPTION |
|---|---|
name |
Member name, never indented; nesting is carried by
TYPE:
|
kind |
Member classification, one of
TYPE:
|
summary |
First docstring line, or
TYPE:
|
signature |
Signature for
TYPE:
|
depth |
Nesting level inside a tree-shaped group,
TYPE:
|
__post_init__
¶
Validate the kind, its agreement with signature, and depth.
| RAISES | DESCRIPTION |
|---|---|
ValueError
|
When |
Source code in src/mixpanel_headless/_internal/help/models.py
to_dict
¶
Convert to a JSON-serializable dict.
| RETURNS | DESCRIPTION |
|---|---|
dict[str, object]
|
A dict with |
dict[str, object]
|
|
Source code in src/mixpanel_headless/_internal/help/models.py
mixpanel_headless.Group
dataclass
¶
A titled group of members, used for Workspace domain grouping.
| ATTRIBUTE | DESCRIPTION |
|---|---|
title |
Group title, for example
TYPE:
|
items |
Members in the group.
TYPE:
|
to_dict
¶
Convert to a JSON-serializable dict.
| RETURNS | DESCRIPTION |
|---|---|
dict[str, object]
|
|
Source code in src/mixpanel_headless/_internal/help/models.py
mixpanel_headless.UsageDoc
dataclass
¶
One Workspace method that accepts a given type ("Used by Workspace").
| ATTRIBUTE | DESCRIPTION |
|---|---|
method |
Method name on
TYPE:
|
params |
Names of the parameters whose annotation references the type.
TYPE:
|
to_dict
¶
Convert to a JSON-serializable dict.
| RETURNS | DESCRIPTION |
|---|---|
dict[str, object]
|
|
mixpanel_headless.Hint
dataclass
¶
Pointer to a hosted documentation page.
| ATTRIBUTE | DESCRIPTION |
|---|---|
title |
Short human-readable label, for example
TYPE:
|
url |
Absolute URL of the page.
TYPE:
|
to_dict
¶
Convert to a JSON-serializable dict.
| RETURNS | DESCRIPTION |
|---|---|
dict[str, object]
|
|
mixpanel_headless.SearchResult
dataclass
¶
Result of reference.search(term).
| ATTRIBUTE | DESCRIPTION |
|---|---|
term |
The search term as given.
TYPE:
|
hits |
Matching entries in display order, duplicates removed.
TYPE:
|
suggestions |
"Did you mean?" names when there are no hits.
TYPE:
|
to_dict
¶
Convert to a JSON-serializable dict.
| RETURNS | DESCRIPTION |
|---|---|
dict[str, object]
|
|
Source code in src/mixpanel_headless/_internal/help/models.py
mixpanel_headless.SearchHit
dataclass
¶
One search result row.
| ATTRIBUTE | DESCRIPTION |
|---|---|
category |
Display category: the
TYPE:
|
name |
Matched name, qualified for
TYPE:
|
summary |
First docstring line, or
TYPE:
|
matched_on |
Which part of the entry matched the term.
TYPE:
|
to_dict
¶
Convert to a JSON-serializable dict.
| RETURNS | DESCRIPTION |
|---|---|
dict[str, object]
|
A dict with the four scalar fields. |
Source code in src/mixpanel_headless/_internal/help/models.py
Errors¶
describe() raises HelpLookupError on a miss and HelpDomainError (a HelpLookupError subclass) when domain= names no registered domain, matches several titles, or is given with a query other than Workspace. search() raises HelpLookupError for an empty term. help() catches a plain miss and prints the suggestions and the first search hits; it re-raises HelpDomainError. Both exceptions are listed with the rest of the hierarchy under Exceptions.
HelpLookupError¶
Carries query, suggestions, and hits; details (and so to_dict()) includes the hits as dicts. The CLI prints the miss on stdout and exits 4.
mixpanel_headless.HelpLookupError
¶
Bases: MixpanelHeadlessError
A mixpanel_headless.help() / reference.describe() query matched nothing.
Raised by :func:mixpanel_headless.reference.describe (and re-raised by
:func:mixpanel_headless.reference.search for an empty term) when the
query names no export, no Workspace member, and no parameter. The
lookup is fully offline, so this is never an HTTP failure and the base is
:class:MixpanelHeadlessError, not :class:APIError. The CLI maps it to
ExitCode.NOT_FOUND (4).
The instance carries the structured recovery data the plain-text
help() wrapper prints: close-name suggestions (difflib) and the
first search hits for the same term.
| ATTRIBUTE | DESCRIPTION |
|---|---|
query |
The query string as the caller gave it.
TYPE:
|
suggestions |
Close names in
TYPE:
|
hits |
Search hits (
TYPE:
|
Example
Initialize a help lookup miss.
| PARAMETER | DESCRIPTION |
|---|---|
query
|
The query string that matched nothing.
TYPE:
|
suggestions
|
Close names to offer, most similar first. Stored as
a tuple. Rendered as
TYPE:
|
hits
|
Search hits for the same term. Stored as a tuple and kept
out of the message; the
TYPE:
|
Source code in src/mixpanel_headless/exceptions.py
HelpDomainError¶
Carries query (the help query, never the domain), domain, domains (the titles to offer), and reason (unknown, ambiguous, or not_workspace; the HelpDomainReason literal). Error code HELP_BAD_DOMAIN. The CLI prints the message and one Domains: line on stderr and exits 3.
mixpanel_headless.HelpDomainError
¶
HelpDomainError(
query: str,
*,
domain: str,
domains: Sequence[str] = (),
reason: HelpDomainReason = "unknown",
)
Bases: HelpLookupError
The domain= filter of a help query was rejected.
Raised by :func:mixpanel_headless.reference.describe when domain
matches no registered Workspace domain title, matches several titles
(an ambiguous prefix), or is given with a query other than the
Workspace listing. The query itself resolved fine, so this is not a
lookup miss: :func:mixpanel_headless.reference.help re-raises it
instead of printing suggestions, and the CLI maps it to
ExitCode.INVALID_ARGS (3) instead of NOT_FOUND (4).
It subclasses :class:HelpLookupError so an except HelpLookupError
still catches it; suggestions mirrors domains and hits is
always empty.
| ATTRIBUTE | DESCRIPTION |
|---|---|
query |
The help query text (
|
domain |
The
TYPE:
|
domains |
Every registered title for an unknown domain, the candidate
titles for an ambiguous prefix,
TYPE:
|
reason |
TYPE:
|
Example
Initialize a rejected domain filter.
| PARAMETER | DESCRIPTION |
|---|---|
query
|
The help query text the filter was applied to.
TYPE:
|
domain
|
The rejected
TYPE:
|
domains
|
Titles to offer: all of them for
TYPE:
|
reason
|
Which check failed; picks the message.
TYPE:
|