Repository navigation
feat(python): Create sdkgen - #13
Conversation
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
Generated clients currently mishandle several valid OpenAPI inputs, and the documented SDK transport does not satisfy the generated contract.
Review effort: Balanced
Findings: 6
Open (13)
Align generated transport calls with the SDK runtime API · New Classify named map schemas consistently as aliases · New Reject operations without tags instead of omitting them · New Serialize numeric and boolean path parameters before encoding · New Reject unsupported success response media types · New Reject unsupported required request-body media types · New Fail closed when wheel fingerprints are unavailable · New Merge inherited path-item headers into operations · New Preserve required query and header parameters in signatures · New Serialize typed header values before insertion · New Include typing_extensions in the dependency summary · New Document the typing_extensions runtime dependency · New Import os in the example · New
What changed in this PR
Adds Python sdkgen tooling to generate and publish standalone plugin API clients.
Changes:
- Adds Python model, resource, transport, metadata, and package templates.
- Adds build, validation, and PyPI publication tooling with source fingerprints.
- Documents generation and generated-package usage.
| File | Description |
|---|---|
python/tools/sdkgen/templates/transport.py.tmpl |
Defines the transport protocols. |
python/tools/sdkgen/templates/resources.tmpl |
Generates resource clients. |
python/tools/sdkgen/templates/README.md.tmpl |
Generates package documentation. |
python/tools/sdkgen/templates/pyproject.toml.tmpl |
Defines generated package metadata. |
python/tools/sdkgen/templates/models.py.tmpl |
Generates Pydantic wire models. |
python/tools/sdkgen/templates/meta.py.tmpl |
Records versions and fingerprints. |
python/tools/sdkgen/templates/__init__.py.tmpl |
Exports and groups generated clients. |
python/tools/sdkgen/static/LICENSE.md |
Supplies generated package licensing. |
python/tools/sdkgen/README.md |
Documents the generator workflow. |
python/tools/sdkgen/publish-check.sh |
Validates published source fingerprints. |
python/tools/sdkgen/Makefile |
Implements generation, build, checks, and publication. |
python/tools/sdkgen/.gitignore |
Excludes generated build output. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
a5dc1e2 to
19743a7
Compare
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
Generated clients can omit operations or responses, produce invalid Python, and reach publishing without validation.
Review effort: Balanced
Findings: 10
Open (13)
Publish bypasses wheel import and type checks · New Normalized tag names collide in generated APIs · New Python keyword tags generate invalid attributes · New Free-form property names are not escaped · New Only the first successful response is generated · New Schema-less JSON responses discard their body · New Operation IDs can collide or shadow transport · New Generated parameter names can collide · New Query parameter names are not escaped · New Classify named map schemas consistently as aliases Unpinned formatter causes nondeterministic publishing · New Imports omit operations with secondary tags · New Cookie parameters are silently omitted · New
Resolved since last review (12)
Reject unsupported required request-body media types Reject unsupported success response media types Serialize numeric and boolean path parameters before encoding Reject operations without tags instead of omitting them Align generated transport calls with the SDK runtime API Serialize typed header values before insertion Preserve required query and header parameters in signatures Merge inherited path-item headers into operations Fail closed when wheel fingerprints are unavailable Import os in the example Document the typing_extensions runtime dependency Include typing_extensions in the dependency summary
19743a7 to
67044a2
Compare
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
Generated methods can mishandle valid request and response shapes, while the publication fingerprints do not fully guarantee identical sources.
Review effort: Balanced
Findings: 1
Open (7)
Handle mixed content and no-content success responses · New Include Ruff version in generation fingerprints · New Preserve required bodies when no identifier properties are found · New Reserve all CallOptions keys from parameter names · New Unpinned formatter causes nondeterministic publishing Define the UUID in the documented example · New Define imports and UUID in the generated example · New
Resolved since last review (12)
Query parameter names are not escaped Generated parameter names can collide Operation IDs can collide or shadow transport Schema-less JSON responses discard their body Only the first successful response is generated Free-form property names are not escaped Python keyword tags generate invalid attributes Normalized tag names collide in generated APIs Publish bypasses wheel import and type checks Classify named map schemas consistently as aliases Cookie parameters are silently omitted Imports omit operations with secondary tags
67044a2 to
063ab89
Compare
063ab89 to
d57d925
Compare
d57d925 to
7d827d8
Compare
7d827d8 to
37b2717
Compare
37b2717 to
29d8557
Compare
476ee66 to
4378524
Compare
4378524 to
062a18e
Compare
062a18e to
e0bf9ef
Compare
e0bf9ef to
f031712
Compare
Go and JS generate a client package for each plugin from its spec, but Python had no such tool, so a plugin had no Python client short of copying its generated plumbing into the SDK. sdkgen renders unikraft-cloud-plugin-<name>-api from each spec. It takes a Transport shaped like ApiClient rather than the SDK, so the two depend one way, and publish refuses changed sources under an unchanged version. Signed-off-by: Daniel Vallance <daniel@unikraft.com>
f031712 to
9e58d2a
Compare
There was a problem hiding this comment.
Copilot review overview
🔵 Needs a closer look
The large generator and publishing pipeline depends on an external SDK transport change and lacks repository-local integration fixtures for final validation.
Review effort: Balanced
Findings: None
Resolved since last review (1)
aabedraba
left a comment
There was a problem hiding this comment.
Read the documented parts on this PR. Seems very well tested against the final SDK layer, and the flow is similar to the TS counterpart. 👍
I recommend using a skill to map the different parts of the SDK, so that it saves you time with the LLMs: https://github.com/unikraft-cloud/js-sdk/blob/prod-staging/.agents/skills/js-sdk-map/SKILL.md
Reviewed-by: Abdallah Abedraba abdallah@unikraft.com
Approved-by: Abdallah Abedraba abdallah@unikraft.com



Go and JS generate a client package for each plugin from its spec, but Python had no such tool, so a plugin had no Python client short of copying its generated plumbing into the SDK.
sdkgen renders unikraft-cloud-plugin--api from each spec. It takes a Transport shaped like ApiClient rather than the SDK, so the two depend one way, and publish refuses changed sources under an unchanged version.