Skip to content

fix(python-sdk): rename Suibets to SuiBets for cross-SDK consistency#774

Merged
realfishsam merged 2 commits into
pmxt-dev:mainfrom
PrettyFox0:fix/python-sdk-suibets-casing
Jun 1, 2026
Merged

fix(python-sdk): rename Suibets to SuiBets for cross-SDK consistency#774
realfishsam merged 2 commits into
pmxt-dev:mainfrom
PrettyFox0:fix/python-sdk-suibets-casing

Conversation

@PrettyFox0
Copy link
Copy Markdown
Contributor

Closes #773

Summary

The TypeScript SDK and core engine both use SuiBets as the canonical class name. The Python SDK was the odd one out with the lowercase-b Suibets, breaking exchange-agnostic naming consistency across SDKs.

Changes

  • sdks/python/pmxt/_exchanges.py: rename class SuibetsSuiBets; keep Suibets = SuiBets deprecation alias so existing callers don't break.
  • sdks/python/pmxt/__init__.py: import and export both names; mark Suibets in __all__ as deprecated alias.

The exchange_name="suibets" registration string is unchanged (matches the issue's "registered identifier" note).

Test plan

  • `python -m py_compile sdks/python/pmxt/_exchanges.py sdks/python/pmxt/init.py` passes
  • `from pmxt import SuiBets` works for new callers
  • `from pmxt import Suibets` still works for existing callers

Closes pmxt-dev#773

The TypeScript SDK and core engine both use 'SuiBets' as the canonical
class name. The Python SDK was the only place still using the lowercase-b
'Suibets', breaking exchange-agnostic naming consistency.

- Rename class to SuiBets in _exchanges.py
- Update __init__.py export and __all__
- Keep a 'Suibets = SuiBets' deprecation alias so existing callers don't break
Copy link
Copy Markdown
Contributor

@realfishsam realfishsam left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PR Review: FAIL

What This Does

Renames the Python SDK's Suibets class to SuiBets to match the TypeScript SDK and improves cross-SDK naming consistency, keeping Suibets as a backwards-compatible alias. The motivation is valid — client.ts in the TypeScript SDK does define export class SuiBets extends Exchange.

Blast Radius

Python SDK only. Two files changed: sdks/python/pmxt/_exchanges.py and sdks/python/pmxt/__init__.py. No core, no TypeScript SDK, no router, no OpenAPI schema.

Consumer Verification

Before (base branch):

from pmxt import SuiBets  # ImportError
from pmxt import Suibets   # OK

After (PR branch):

from pmxt import SuiBets   # OK
from pmxt import Suibets   # OK (alias)

Cannot run end-to-end consumer verification — no CI check runs recorded on this PR (0 check runs returned). Build/test status is unknown.

Test Results

  • Build: UNKNOWN (no check runs)
  • Unit tests: UNKNOWN (no check runs)
  • Server starts: NOT TESTED
  • E2E smoke: NOT TESTED

Findings

1. [BLOCKING] Hand-editing an auto-generated file.

sdks/python/pmxt/_exchanges.py carries an explicit header at line 1:

# This file is auto-generated by core/scripts/generate-python-exchanges.js
# Do not edit manually.
# To regenerate: npm run generate:sdk:all --workspace=pmxt-core

The generator's toClassName() function in core/scripts/generate-python-exchanges.js produces 'Suibets' for the exchange name 'suibets':

function toClassName(name) {
    return name
        .split(/[-_]/)
        .map(part => part.toLowerCase() === 'us' ? 'US' : part.charAt(0).toUpperCase() + part.slice(1))
        .join('');
}
// toClassName('suibets') => 'Suibets'

The next run of npm run generate:sdk:all will overwrite _exchanges.py and the import/__all__ sections of __init__.py, reverting both files to Suibets. The fix will silently disappear. This is not a hypothetical: the generator also manages the __init__.py import line and # Exchanges block in __all__, both of which this PR touches.

The correct fix is to update the generator itself. One way: add a classNameOverride field to the OVERRIDES map in generate-python-exchanges.js and thread it through generateClass(). Another: special-case the suibets exchange ID in toClassName(). Either approach must also emit the Suibets = SuiBets backwards-compat alias in the generated output (mirroring how Polymarket_us = PolymarketUS is emitted for polymarket_us).

2. [Minor] Suibets alias emits no DeprecationWarning.

Suibets = SuiBets in _exchanges.py and the __all__ comment note it as deprecated, but accessing pmxt.Suibets at runtime is completely silent. If the intent is to eventually remove it, callers won't know to migrate. Consider a module-level __getattr__ in __init__.py that issues DeprecationWarning when Suibets is accessed by name. This is a minor concern, but it matters if there's a timeline for removal.

PMXT Pipeline Check

  • Field propagation (3-layer): N/A — no data model changes
  • OpenAPI sync: N/A — no BaseExchange/method changes
  • Financial precision: N/A
  • Type safety: N/A — pure rename/alias
  • Auth safety: N/A

Semver Impact

patch — adds a public alias, existing Suibets callers are unaffected. But: the fix doesn't survive regeneration, so it shouldn't ship until the generator is corrected.

Risk

The fix is applied at the wrong layer. _exchanges.py will be overwritten by the generator on the next SDK release cycle, silently reintroducing the bug. The PR should be reworked to fix core/scripts/generate-python-exchanges.js (and optionally update __init__.py by re-running the generator) rather than patching the generated output directly.


Generated by Claude Code

The original fix patched generated files (sdks/python/pmxt/_exchanges.py
and __init__.py), which `npm run generate:sdk:all` would silently revert.
Move the rename into core/scripts/generate-python-exchanges.js as a
class-name override, mirroring the existing Polymarket_us → PolymarketUS
alias pattern. Regenerate the SDK files.

Co-authored-by: PrettyFox0 <PrettyFox0@users.noreply.github.com>
@realfishsam realfishsam merged commit 28742af into pmxt-dev:main Jun 1, 2026
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.

[core-sdk-gap] Python SDK exports exchange class as Suibets instead of SuiBets

2 participants