Skip to content

fix(python): drop generated router exchange stub#1023

Open
realfishsam wants to merge 1 commit into
mainfrom
fix/remove-generated-router-exchange
Open

fix(python): drop generated router exchange stub#1023
realfishsam wants to merge 1 commit into
mainfrom
fix/remove-generated-router-exchange

Conversation

@realfishsam

Copy link
Copy Markdown
Contributor

Summary

  • Exclude the special router entry from generated exchange wrappers.
  • Regenerate Python exchange exports so direct imports no longer expose a bare pmxt._exchanges.Router(Exchange) stub; the real pmxt.router.Router remains exported from pmxt.

Fixes #976

Test Plan

  • npm run generate:python-exchanges --workspace=pmxt-core
  • grep -q "class Router(Exchange)" sdks/python/pmxt/_exchanges.py && exit 1 || true
  • grep -q "from .router import Router" sdks/python/pmxt/__init__.py
  • python3 -m py_compile sdks/python/pmxt/_exchanges.py sdks/python/pmxt/__init__.py
  • git diff --check

@realfishsam

Copy link
Copy Markdown
Contributor Author

Maintenance automation note: local validation passed for this generated exchange-wrapper cleanup:

  • npm run generate:python-exchanges --workspace=pmxt-core
  • grep -q "class Router(Exchange)" sdks/python/pmxt/_exchanges.py && exit 1 || true
  • grep -q "from .router import Router" sdks/python/pmxt/__init__.py
  • python3 -m py_compile sdks/python/pmxt/_exchanges.py sdks/python/pmxt/__init__.py
  • git diff --check

CI is currently blocked by repository-wide generated client/API reference drift unrelated to this PR. The in-scope _exchanges.py generation check is green.

@realfishsam

Copy link
Copy Markdown
Contributor Author

PR Review: FAIL

What This Does

Removes the generated Python _exchanges.Router class so pmxt.Router comes only from pmxt.router.Router. This matters to Python SDK consumers because the PR also regenerates exchange constructors.

Blast Radius

Python SDK package exports and generated exchange convenience constructors (sdks/python/pmxt/__init__.py, _exchanges.py, and core/scripts/generate-python-exchanges.js). No core sidecar behavior is changed.

Consumer Verification

Before (base branch):
Python consumers could use hosted constructor options on generated venue classes, e.g. pmxt.Polymarket(pmxt_api_key=..., wallet_address=..., signer=...); the base Exchange.__init__ supports wallet_address and signer.

After (PR branch):
The PR branch generated Polymarket.__init__ at sdks/python/pmxt/_exchanges.py:13-24 and Opinion.__init__ at sdks/python/pmxt/_exchanges.py:283-291 without wallet_address or signer, and the super-call at sdks/python/pmxt/_exchanges.py:39-48 no longer passes them. A consumer using hosted reads/writes through the convenience constructors will hit TypeError: __init__() got an unexpected keyword argument 'wallet_address' before the base client can route hosted requests.

Test Results

  • Build: PASS (npm run build --workspace=pmxt-core)
  • Core unit tests: PASS (27 suites / 652 tests passed; 1 suite / 3 tests skipped)
  • Python syntax: PASS (py_compile on changed Python files)
  • Full npm test: FAIL in this checkout during Python SDK collection because pmxt_internal / eth_account are not available.
  • Server starts: N/A (SDK export/generator-only change)
  • E2E smoke: FAIL by inspection for hosted Python constructor path described above

Findings

  1. sdks/python/pmxt/_exchanges.py:13-24 and sdks/python/pmxt/_exchanges.py:283-291 -- the generator change removed the manual hosted wallet_address/signer constructor parameters from Polymarket and Opinion while trying to drop only the generated router stub. Those venue wrappers no longer expose the base client's hosted wallet/signer path, so existing hosted-mode Python code that passes wallet_address or signer breaks at construction time.

PMXT Pipeline Check

  • Field propagation (3-layer): N/A
  • OpenAPI sync: N/A
  • Financial precision: N/A
  • Type safety: ISSUE (Python convenience constructor signature regression)
  • Auth safety: OK (no credential logging/exposure found)

Semver Impact

major as written -- it removes accepted Python constructor options for hosted Polymarket/Opinion clients.

Risk

Router export cleanup itself is reasonable, but the generator needs to preserve hosted constructor overrides before this is safe to merge.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Python _exchanges.py contains vestigial bare Router(Exchange) class that leaks through direct import

1 participant