Skip to content

[codex] generate sync python platform client - #24

Merged
calvin-archastro merged 2 commits into
mainfrom
features/calvin-archastro-11-05-2026-messages-sent-notif
Jun 12, 2026
Merged

[codex] generate sync python platform client#24
calvin-archastro merged 2 commits into
mainfrom
features/calvin-archastro-11-05-2026-messages-sent-notif

Conversation

@calvin-archastro

@calvin-archastro calvin-archastro commented Jun 12, 2026

Copy link
Copy Markdown
Contributor

What changed

This updates the Python SDK generator for the sync/async client split and Python naming conventions.

  • PlatformClient is the synchronous REST client backed by SyncHttpClient from [codex] add sync Python HTTP client archastro-python#14.
  • AsyncPlatformClient remains the async REST client backed by HttpClient.
  • Async generated resources are prefixed with Async, for example AsyncTeamResource and AsyncV1.
  • Sync generated resources use the unprefixed names, for example TeamResource and V1.
  • Auth follows the same convention: AsyncAuthClient for async and AuthClient for sync.
  • REST contract tests instantiate PlatformClient, call methods without await, and close each sync client.
  • The generator version is bumped to 0.4.0 because the generated Python public surface changes.

Channel generation remains async-only because Phoenix channel/socket workflows are async.

Diagrams

sequenceDiagram
  participant User as Python user
  participant Sync as PlatformClient
  participant Resource as TeamResource
  participant Http as SyncHttpClient
  participant API as Platform API
  participant Async as AsyncPlatformClient
  participant AsyncResource as AsyncTeamResource

  User->>Sync: create client
  Sync->>Resource: bind unprefixed resources
  User->>Resource: teams.list
  Resource->>Http: request
  Http->>API: HTTPS request
  API-->>Http: JSON response
  Http-->>Resource: decoded data
  Resource-->>User: sync return value
  User->>Async: create async client
  Async->>AsyncResource: bind Async resources
Loading
classDiagram
  class PlatformClient {
    V1 v1
    AuthClient auth
    close()
    with_credentials()
  }
  class AsyncPlatformClient {
    AsyncV1 v1
    AsyncAuthClient auth
    async close()
    async with_credentials()
  }
  class V1 {
    TeamResource teams
  }
  class AsyncV1 {
    AsyncTeamResource teams
  }
  class TeamResource {
    list()
    get(team)
  }
  class AsyncTeamResource {
    async list()
    async get(team)
  }
  PlatformClient --> V1
  AsyncPlatformClient --> AsyncV1
  V1 --> TeamResource
  AsyncV1 --> AsyncTeamResource
Loading

Scope

Backend/tooling only: SDK generator and generated Python contract-test templates.

Risk assessment

Medium. This changes generated Python SDK class names and client lifecycle behavior. The change is scoped to Python generation; TypeScript SDK generation and channel runtime behavior are unchanged.

User impact

Generated sync usage:

from archastro.platform import PlatformClient

with PlatformClient(access_token="sat_...") as client:
    user = client.users.me()

Generated async usage:

from archastro.platform import AsyncPlatformClient

async with AsyncPlatformClient(access_token="sat_...") as client:
    user = await client.users.me()

Testing

Passed locally:

  • npm test -w @archastro/sdk-generator -- --run __tests__/backends/python.test.ts
  • npm run build -w @archastro/sdk-generator
  • git diff --check

Follow-ups and known issues

@archastro

archastro Bot commented Jun 12, 2026

Copy link
Copy Markdown

✅ Clean PR, @calvin-archastro! No blocking findings on 9789009 — a few nice things I clocked:

  • Clean removal of the old generic dynamic proxy in favor of typed sync wrappers — the not.toContain("class _SyncResourceProxy:") assertion locks that the sync surface keeps concrete signatures. ✨
  • Nice lifecycle discipline on the sync client — exception-safe _SyncRunner teardown in with_credentials plus _extra_http_clients tracking so the refresh HttpClient gets closed. 🎯
  • Followed the repo's TDD-across-layers convention — sync wrappers land with red-green coverage in resource, auth, client, namespace, and contract-test emitters simultaneously. 🙌

Reply @archastro <verb>: review · do <pattern> · don't <pattern> · forget <slug> · list

@calvin-archastro
calvin-archastro force-pushed the features/calvin-archastro-11-05-2026-messages-sent-notif branch 3 times, most recently from 3e70c35 to 18cb817 Compare June 12, 2026 17:51
@calvin-archastro
calvin-archastro force-pushed the features/calvin-archastro-11-05-2026-messages-sent-notif branch from 18cb817 to f62d0d9 Compare June 12, 2026 18:35
@calvin-archastro
calvin-archastro marked this pull request as ready for review June 12, 2026 19:52
@calvin-archastro
calvin-archastro merged commit 3e097dc into main Jun 12, 2026
2 checks passed
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.

1 participant