Skip to content

feat(python): Create sdkgen - #13

Merged
danielvallance merged 1 commit into
prod-stagingfrom
danielvallance/plugin_gen
Oct 5, 2026
Merged

danielvallance merged 1 commit into
prod-stagingfrom
danielvallance/plugin_gen

Conversation

@danielvallance

Copy link
Copy Markdown
Contributor

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.

@danielvallance
danielvallance requested a balanced review from Copilot October 1, 2026 14:10
@danielvallance
danielvallance marked this pull request as draft October 1, 2026 14:10

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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 High severity · 4 Medium severity · 3 Low severity

Open (13)
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.

Comment thread python/tools/sdkgen/templates/__init__.py.tmpl Outdated
Comment thread python/tools/sdkgen/templates/models.py.tmpl Outdated
Comment thread python/tools/sdkgen/templates/resources.tmpl
Comment thread python/tools/sdkgen/templates/resources.tmpl Outdated
Comment thread python/tools/sdkgen/templates/resources.tmpl Outdated
Comment thread python/tools/sdkgen/templates/resources.tmpl
Comment thread python/tools/sdkgen/templates/resources.tmpl Outdated
Comment thread python/tools/sdkgen/README.md Outdated
Comment thread python/tools/sdkgen/templates/README.md.tmpl Outdated
Comment thread python/tools/sdkgen/templates/README.md.tmpl

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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 High severity · 3 Medium severity

Open (13)
Resolved since last review (12)

Comment thread python/tools/sdkgen/Makefile Outdated
Comment thread python/tools/sdkgen/templates/__init__.py.tmpl Outdated
Comment thread python/tools/sdkgen/templates/__init__.py.tmpl Outdated
Comment thread python/tools/sdkgen/templates/models.py.tmpl Outdated
Comment thread python/tools/sdkgen/templates/resources.tmpl Outdated
Comment thread python/tools/sdkgen/templates/resources.tmpl
Comment thread python/tools/sdkgen/templates/resources.tmpl Outdated
Comment thread python/tools/sdkgen/Makefile Outdated
Comment thread python/tools/sdkgen/templates/resources.tmpl Outdated
Comment thread python/tools/sdkgen/templates/resources.tmpl

Copilot AI left a comment

Copy link
Copy Markdown

Comment thread python/tools/sdkgen/templates/resources.tmpl
Comment thread python/tools/sdkgen/Makefile Outdated
Comment thread python/tools/sdkgen/templates/resources.tmpl Outdated
Comment thread python/tools/sdkgen/templates/resources.tmpl Outdated
Comment thread python/tools/sdkgen/templates/README.md.tmpl
Comment thread python/tools/sdkgen/templates/__init__.py.tmpl

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Comment thread python/tools/sdkgen/templates/models.py.tmpl
Comment thread python/tools/sdkgen/Makefile Outdated

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Comment thread python/tools/sdkgen/templates/__init__.py.tmpl Outdated
Comment thread python/tools/sdkgen/templates/models.py.tmpl
Comment thread python/tools/sdkgen/templates/models.py.tmpl Outdated
Comment thread python/tools/sdkgen/templates/resources.tmpl

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Comment thread python/tools/sdkgen/templates/resources.tmpl
Comment thread python/tools/sdkgen/templates/resources.tmpl Outdated
Comment thread python/tools/sdkgen/templates/models.py.tmpl Outdated
Comment thread python/tools/sdkgen/templates/models.py.tmpl Outdated

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Comment thread python/tools/sdkgen/templates/models.py.tmpl Outdated
Comment thread python/tools/sdkgen/templates/transport.py.tmpl
Comment thread python/tools/sdkgen/templates/resources.tmpl
@danielvallance
danielvallance force-pushed the danielvallance/plugin_gen branch from 37b2717 to 29d8557 Compare October 2, 2026 18:27
@danielvallance
danielvallance requested a balanced review from Copilot October 2, 2026 18:28

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot review overview

🔵 Needs a closer look

The configured generator silently omits HEAD operations that the templates explicitly support.

Review effort: Balanced
Findings: None

Resolved since last review (2)

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot review overview

🟡 Changes recommended

Inline enum imports and type-less map schemas currently produce incorrect generated typing.

Review effort: Balanced
Findings: 1 High severity

Open (1)

Comment thread python/tools/sdkgen/templates/resources.tmpl

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot review overview

🟡 Changes recommended

Nullable parameters can generate unserializable calls, and nullable response annotations conflict with the transport protocol.

Review effort: Balanced
Findings: 2 High severity

Open (2)
Resolved since last review (1)

Comment thread python/tools/sdkgen/templates/resources.tmpl
Comment thread python/tools/sdkgen/templates/resources.tmpl

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot review overview

🟡 Changes recommended

Fingerprinting can miss tree moves, and interrupted PyPI publication cannot be retried safely.

Review effort: Balanced
Findings: 1 Medium severity · 1 Low severity

Open (2)
Resolved since last review (2)

Comment thread python/tools/sdkgen/publish-check.sh
Comment thread python/tools/sdkgen/Makefile Outdated

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot review overview

🟡 Changes recommended

OpenAPI version values can currently inject shell commands during Make expansion.

Review effort: Balanced
Findings: 1 High severity

Open (1)
Resolved since last review (2)

Comment thread python/tools/sdkgen/Makefile Outdated
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>

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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 aabedraba left a comment

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.

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

@danielvallance
danielvallance merged commit 515d755 into prod-staging Oct 5, 2026
7 checks passed
@danielvallance
danielvallance deleted the danielvallance/plugin_gen branch October 5, 2026 09:53
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.

3 participants