Skip to content

refactor: flip spine to NemoClient + swap all SDK imports - #1482

Closed
maxdubrinsky wants to merge 1 commit into
aircore-827-compat-layer/mdubrinskyfrom
aircore-827-spine-flip/mdubrinsky
Closed

refactor: flip spine to NemoClient + swap all SDK imports#1482
maxdubrinsky wants to merge 1 commit into
aircore-827-compat-layer/mdubrinskyfrom
aircore-827-spine-flip/mdubrinsky

Conversation

@maxdubrinsky

Copy link
Copy Markdown
Contributor

Summary

Flip sdk_factory to return NemoClient/AsyncNemoClient instead of NeMoPlatform/AsyncNeMoPlatform. Rewrite the bridge adapter to use from_client() instead of reading Stainless private attrs. Swap all 528 consumer files from from nemo_platform imports to typed client imports. Type annotations changed throughout (NeMoPlatform -> NemoClient, AsyncNeMoPlatform -> AsyncNemoClient).

Method calls use new typed client method names (get_workspace, create_guardrail_config, etc.) from PR 1. Old method names are also available via the compat layer from PR 2.

Related Issue

AIRCORE-827

Changes

  • sdk_factory.py: Spine flip — returns NemoClient/AsyncNemoClient, PlatformClientT TypeVar bound to typed clients, URL resolver adapted
  • adapter.py: Rewritten to use ClientCls.from_client(platform) instead of reading Stainless private attrs (_custom_headers, _client, _prepare_url, etc.)
  • 528 consumer files: Import swaps (from nemo_platform -> typed client modules), type annotation changes, method name renames (old SDK names -> new typed client names)
  • 24 files left as-is: Still import from nemo_platform (enhanced NeMoPlatform client, error handlers, code generators, pagination types). The SDK is still present, so these imports work. Full migration happens when the code generators are updated and the SDK is deleted (PR 10).
  • Pyproject.toml files NOT changed: SDK deps kept since the SDK is still present. Removal happens in PR 10.

Type of Change

  • Code change (feature, bug fix, or refactor)
  • Code change with documentation updates
  • Documentation only
  • Contributor tooling or automation
  • CI, build, or test infrastructure

Quality Gates

  • Tests added or updated for changed behavior
  • Existing tests cover changed behavior — justification: mechanical import/type swaps; behavior unchanged
  • Tests not applicable — justification:
  • Documentation updated for user-visible behavior
  • Documentation not applicable — justification: internal refactoring, no user-visible API change

Verification

  • Pull request title follows the repository's Conventional Commit format
  • Every commit includes an appropriate Signed-off-by: trailer
  • uv run pre-commit run -a passes, or any blocked checks are identified below
  • Targeted tests pass, or tests are marked not applicable above
  • No secrets, API keys, or credentials are included

Targeted validation:

  • py_compile on all 528 modified .py files: all compile (syntax OK)
  • DCO audit: 5 commits, all sign-offs match author email
  • Pre-commit, ruff, and targeted pytest not yet run in the worktree (draft); will run before marking ready for review
  • 24 files with remaining from nemo_platform imports are expected (SDK still present)

Stack

PR 3 of the Stainless purge stack:

Note: The original plan had PRs 4-8 (per-area method renames) branching from PR 3. Since the exploration's files already include method renames alongside import swaps, those are folded into PR 3. The plan simplifies from 10 PRs to 5.

Flip sdk_factory to return NemoClient/AsyncNemoClient instead of
NeMoPlatform/AsyncNeMoPlatform. Rewrite the bridge adapter to use
from_client() instead of reading Stainless private attrs. Swap all
528 consumer files from 'from nemo_platform' imports to typed client
imports (nemo_platform_plugin.client.client, .errors, .types, etc.).

Type annotations changed: NeMoPlatform -> NemoClient,
AsyncNeMoPlatform -> AsyncNemoClient throughout.

Method calls use new typed client method names (get_workspace,
create_guardrail_config, etc.) which are available on the typed
clients from PR 1. Old method names (retrieve, create, list, etc.)
are also available via the compat layer from PR 2.

The Stainless SDK remains in place (deletion is PR 10). 24 files
that still import from nemo_platform (enhanced NeMoPlatform client,
error handlers, code generators) are left as-is since the SDK is
still present and importable.

Pyproject.toml files are NOT changed (SDK deps kept) — removal
happens in PR 10 when the SDK is actually deleted.

AIRCORE-827

Signed-off-by: Max Dubrinsky <mdubrinsky@nvidia.com>
@github-actions

Copy link
Copy Markdown
Contributor

@maxdubrinsky
maxdubrinsky deleted the branch aircore-827-compat-layer/mdubrinsky August 24, 2026 17:34
@maxdubrinsky

Copy link
Copy Markdown
Contributor Author

Closing in favor of area-by-area consumer migration approach (migrate consumers first via client_from_platform, flip spine last). The compat layer and big-bang spine flip are unnecessary.

@maxdubrinsky
maxdubrinsky deleted the aircore-827-spine-flip/mdubrinsky branch August 24, 2026 17:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant