Skip to content

Feat/async typed sdk#225

Open
YashGaykar0309 wants to merge 26 commits into
mainfrom
feat/async-typed-sdk
Open

Feat/async typed sdk#225
YashGaykar0309 wants to merge 26 commits into
mainfrom
feat/async-typed-sdk

Conversation

@YashGaykar0309
Copy link
Copy Markdown
Contributor

@YashGaykar0309 YashGaykar0309 commented May 27, 2026

Description

Implements the foundation for an async-first, OpenAPI-driven Python SDK with generated typed service clients. The architecture now supports multi-service expansion such as OSC/OAPI, OKS and future services through a modular core plus generated service layers.

Main goals:

  • async-first design
  • multi-service support
  • strong typing and request/response validation
  • profile/config-based client creation
  • minimal integration complexity
  • modular core + generated service architecture
  • OpenAPI-driven client generation

Fixes: NA

Type of Change

Please check the relevant option(s):

  • 🐛 Bug fix
  • ✨ New feature
  • 🧹 Code cleanup or refactor
  • 📝 Documentation update
  • 🔧 Build or CI-related change
  • 🔒 Security fix
  • Other (specify):

How Has This Been Tested?

Please describe the test strategy:

  • Manual testing
  • Unit tests
  • Integration tests
  • Not tested yet

Commands used (if applicable):

uv run python -m pytest tests

Checklist

  • I have followed the Contributing Guidelines
  • I have added tests or explained why they are not needed
  • I have updated relevant documentation (README, examples, etc.)
  • My changes follow the Conventional Commits specification
  • My commits include appropriate Gitmoji

@YashGaykar0309 YashGaykar0309 requested a review from a team May 27, 2026 11:24
super().__init__(
os.path.join(os.path.dirname(__file__), "resources/outscale.yaml"), **kwargs

class AsyncOpenAPIActionAPI(OpenAPIActionAPI):
self.close()


class AsyncOpenAPIPathAPI(OpenAPIPathAPI):
request: GetKubernetesVersionsRequest | None = None,
) -> KubernetesVersionsResponse:
if request is None:
request = GetKubernetesVersionsRequest()
request: GetCPSubregionsRequest | None = None,
) -> CPSubregionsResponse:
if request is None:
request = GetCPSubregionsRequest()
request: GetControlPlanePlansRequest | None = None,
) -> ControlPlanesResponse:
if request is None:
request = GetControlPlanePlansRequest()
request: GetNetPeeringRequestTemplateRequest | None = None,
) -> TemplateResponse_NetPeeringRequest:
if request is None:
request = GetNetPeeringRequestTemplateRequest()
request: GetNetPeeringAcceptanceTemplateRequest | None = None,
) -> TemplateResponse_NetPeeringAcceptance:
if request is None:
request = GetNetPeeringAcceptanceTemplateRequest()
request: GetQuotasRequest | None = None,
) -> quotas__quota_schema__QuotasResponse:
if request is None:
request = GetQuotasRequest()
request: GetClientIPRequest | None = None,
) -> IPResponse:
if request is None:
request = GetClientIPRequest()
import asyncio
import copy
import os
import sys
Copy link
Copy Markdown
Contributor

@jobs62 jobs62 left a comment

Choose a reason for hiding this comment

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

Good start. Despite all comments i made, it whould be nice that public facing methods raise only "owned" exception. also string enum support whould be nice in the generator (that may need support for overlays as well)

api_version:
description: 'Outscale API version'
required: true
oks_api_url:
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Both services can have different release plan, so we should be able to build and release one without the other

env:
OSC_ACCESS_KEY: ${{ secrets.OSC_ACCESS_KEY }}
OSC_SECRET_KEY: ${{ secrets.OSC_SECRET_KEY }}
OSC_ACCESS_KEY_V2: ${{ secrets.OSC_ACCESS_KEY_V2 }}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

not needed

Comment thread docs/examples.md


async def main():
async with AsyncClient(profile="profile_1") as client:
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

we should have one client per service

Comment thread docs/examples.md Outdated
async def main():
async with AsyncGateway() as gw:
# Example: list VMs
vms = await gw.ReadVms()
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

method name should by OperationId converted in snake case

json_body: dict | list | None = None
query_params: dict = field(default_factory=dict)

def resolved_path(self, path_params: dict | None = None) -> str:
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

this should probably throw an error if one or more placeholders are not remplaced

@@ -1 +1 @@
import datetime
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

all that file could be removed and remplaced by a httpx middleware

Comment thread osc_sdk_python/limiter.py
from datetime import datetime, timezone, timedelta
import asyncio
import time

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

same as authentication, limiter should be a httpx middleware

@@ -0,0 +1,131 @@
import asyncio
import json
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

should be a httpx middleware as well

from ..request import RequestSpec


class AsyncCall(object):
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

you can probably get ride of Call/Requester. i never understood why we had that much boilerplate for parameters of transports (should be in the session or a middleware ?)

Comment thread pyproject.toml
dependencies = [
"httpx>=0.28.0",
"pydantic>=2.0.0",
"requests>=2.20.0",
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

requests should not be used anymore

Updated README and docs examples to use Client / AsyncClient and async snake_case operation methods.

Added unresolved path placeholder validation in RequestSpec with unit tests.

Removed unnecessary IAM v2 secret injection from the CI workflow while keeping SDK credential support unchanged.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

3 participants