Skip to content

fix(python): annotate remaining error constructors#1022

Open
realfishsam wants to merge 1 commit into
mainfrom
fix/python-init-return-types
Open

fix(python): annotate remaining error constructors#1022
realfishsam wants to merge 1 commit into
mainfrom
fix/python-init-return-types

Conversation

@realfishsam

Copy link
Copy Markdown
Contributor

Summary

  • Add explicit -> None return annotations to the remaining typed error constructors.
  • Keeps the public runtime behavior unchanged while satisfying the Python type annotation cleanup.

Fixes #731

Test Plan

  • python3 -m py_compile sdks/python/pmxt/errors.py sdks/python/pmxt/_exchanges.py
  • python3 -m compileall -q sdks/python/pmxt

@realfishsam

Copy link
Copy Markdown
Contributor Author

Maintenance automation note: local validation passed for this focused Python typing cleanup:

  • python3 -m py_compile sdks/python/pmxt/errors.py sdks/python/pmxt/_exchanges.py
  • python3 -m compileall -q sdks/python/pmxt

CI is currently blocked by repository-wide generated client/API reference drift. I checked the generators, but committing their output would include broad hosted-client/docs changes unrelated to this one-file constructor annotation PR, so I left the PR scoped.

@realfishsam

Copy link
Copy Markdown
Contributor Author

PR Review: PASS (NOT VERIFIED)

What This Does

Adds explicit -> None return annotations to remaining Python SDK error constructors. This is type-hygiene only and does not change runtime error mapping for SDK consumers.

Blast Radius

Python SDK error classes in sdks/python/pmxt/errors.py only.

Consumer Verification

Before (base branch):
Constructors such as OrderNotFound(order_id, exchange=None) and NetworkError(message, exchange=None) already initialized the same PMXT error codes and retryability flags, but lacked explicit return annotations.

After (PR branch):
The signatures now include -> None while preserving the same super().__init__ arguments and error codes. I verified changed Python syntax with python3 -m py_compile sdks/python/pmxt/errors.py.

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 errors.py)
  • Full npm test: FAIL in this checkout during Python SDK collection because pmxt_internal / eth_account are not available.
  • Server starts: N/A (type annotation only)
  • E2E smoke: N/A (not observable through sidecar HTTP API)

Findings

No blocking findings.

PMXT Pipeline Check

  • Field propagation (3-layer): N/A
  • OpenAPI sync: N/A
  • Financial precision: N/A
  • Type safety: OK
  • Auth safety: N/A

Semver Impact

patch -- Python type annotation cleanup only.

Risk

I could not run the Python SDK test suite end-to-end in this checkout because generated/internal Python dependencies are unavailable, but the changed constructors are mechanically annotation-only.

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-types] errors.py: 3 exception __init__ methods missing -> None return type

1 participant