Skip to content

sdk-drift: Python _exchanges.py defines a bare Router stub that shadows the real Router for direct importers #759

@realfishsam

Description

@realfishsam

SDK Drift: Bare Router stub in _exchanges.py

Location

  • Python: sdks/python/pmxt/_exchanges.py lines ~533–555
  • Python: sdks/python/pmxt/__init__.py

Description

_exchanges.py (the auto-generated exchange registry) defines a Router class that is a bare Exchange subclass — it has none of the matching/arbitrage methods that the real Router in router.py provides:

# In _exchanges.py (stub — NO routing methods)
class Router(Exchange):
    ...

__init__.py imports Router from _exchanges first, then re-imports and overwrites it with the real Router from .router:

from ._exchanges import Router        # stub — immediately discarded
from .router import Router            # real Router wins

The top-level pmxt.Router therefore correctly exposes the full API, but anyone who does from pmxt._exchanges import Router directly gets a broken object that only has the base Exchange methods.

The TypeScript SDK has no such ambiguity — the single Router class in router.ts has the full API and is the only export.

Impact

  • Direct _exchanges.py importers (e.g. users inspecting internals, generated client code, test helpers) silently receive a stripped-down Router.
  • The auto-generation pipeline that produces _exchanges.py should either omit the Router entry or generate it as a proper re-export of router.Router.

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2: mediumbugSomething isn't workingeffort: smallmaintenanceCode maintenance and cleanuppythonPython SDK specificsdk-driftCross-language SDK consistency findings (TypeScript vs Python)sdk-parityConsistency between SDKstype: dead-code

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions