You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Note: This is a supplement to #227, which covers params: Optional[dict], missing return types on private helpers, and Optional[Any] usage. The items below are distinct gaps not covered by that issue.
Missing Return Types
Line 278 — Exchange.__init__ (CRITICAL — public constructor)
def__init__(
self,
exchange_name: str,
...
):
The base Exchange constructor is missing -> None. PEP 484 requires __init__ to be explicitly annotated. Without it, disallow_untyped_defs = true (tracked in #246) will reject it at CI.
Line 1759 — _require_ws_transport (HIGH — called by every streaming method)
def_require_ws_transport(self, method_name: str):
Returns a SidecarWsClient on success and raises PmxtError on failure. Missing return type → should be -> "SidecarWsClient".
Missing Parameter Types
Line 90 — _auto_convert (HIGH — called by every converter function)
cls is untyped → should be Type[Any] (or a TypeVar bound to a dataclass)
**overrides is untyped → should be **overrides: Any
Return type missing → should be -> Any (or the bound TypeVar)
Bare Built-in Variable Annotations (MEDIUM — widespread)
Every generated method body uses inline bare types:
body: dict= {"args": args} # should be Dict[str, Any]
Affected methods (18 total in the # BEGIN GENERATED METHODS block): fetch_markets, fetch_markets_paginated, fetch_events, fetch_market, fetch_event, fetch_order_book, fetch_order_books, cancel_order, fetch_order, fetch_open_orders, fetch_my_trades, fetch_closed_orders, fetch_all_orders, fetch_positions, fetch_balance, fetch_market_matches, fetch_matches, fetch_event_matches, compare_market_prices, fetch_related_markets, fetch_matched_markets, fetch_matched_prices, fetch_hedges, fetch_arbitrage
Bare list annotations also appear in streaming methods:
Line 1982 (watch_all_order_books): args: list = [effective_venues] if effective_venues else []
Line 2075 (watch_address): args: list = [address]
Line 2079 (watch_address): body: dict = {"args": args}
Impact
Exchange.__init__ missing -> None affects every user constructing any exchange subclass (Polymarket, Kalshi, Router, etc.). IDEs cannot infer the constructor return type, which causes incomplete hover documentation.
_auto_convert is the single shared converter that builds every model object returned by the SDK. An untyped cls parameter means the return type cannot be inferred by static analysis.
File
sdks/python/pmxt/client.pyMissing Return Types
Line 278 —
Exchange.__init__(CRITICAL — public constructor)The base
Exchangeconstructor is missing-> None. PEP 484 requires__init__to be explicitly annotated. Without it,disallow_untyped_defs = true(tracked in #246) will reject it at CI.Line 1759 —
_require_ws_transport(HIGH — called by every streaming method)Returns a
SidecarWsClienton success and raisesPmxtErroron failure. Missing return type → should be-> "SidecarWsClient".Missing Parameter Types
Line 90 —
_auto_convert(HIGH — called by every converter function)clsis untyped → should beType[Any](or aTypeVarbound to a dataclass)**overridesis untyped → should be**overrides: Any-> Any(or the boundTypeVar)Bare Built-in Variable Annotations (MEDIUM — widespread)
Every generated method body uses inline bare types:
Affected methods (18 total in the
# BEGIN GENERATED METHODSblock):fetch_markets,fetch_markets_paginated,fetch_events,fetch_market,fetch_event,fetch_order_book,fetch_order_books,cancel_order,fetch_order,fetch_open_orders,fetch_my_trades,fetch_closed_orders,fetch_all_orders,fetch_positions,fetch_balance,fetch_market_matches,fetch_matches,fetch_event_matches,compare_market_prices,fetch_related_markets,fetch_matched_markets,fetch_matched_prices,fetch_hedges,fetch_arbitrageBare
listannotations also appear in streaming methods:watch_all_order_books):args: list = [effective_venues] if effective_venues else []watch_address):args: list = [address]watch_address):body: dict = {"args": args}Impact
Exchange.__init__missing-> Noneaffects every user constructing any exchange subclass (Polymarket, Kalshi, Router, etc.). IDEs cannot infer the constructor return type, which causes incomplete hover documentation._auto_convertis the single shared converter that builds every model object returned by the SDK. An untypedclsparameter means the return type cannot be inferred by static analysis.body: dict/args: listannotations withdisallow_untyped_defs = trueenabled ([python-types] pyproject.toml: disallow_untyped_defs = false allows all type gaps to silently pass #246) will cause mypy errors across all 24+ generated methods at once.Suggested Fix
Found by automated Python type hints audit