feat: add a2a-python SUT code generation - #139
Conversation
Add a Python code emitter that generates a runnable SUT project from Gherkin scenarios using the a2a-python SDK, mirroring the existing a2a-java pipeline. New files: - codegen/python_emitter.py — maps Actions to TaskUpdater API calls - codegen/a2a-python/*.j2 — Jinja2 templates (sut_agent.py, pyproject.toml) - tests/unit/codegen/test_python_emitter.py — 6 unit tests - sut/a2a-python/ — generated SUT project (16 scenarios) Modified: - codegen/generator.py — register a2a-python emitter - Makefile — add codegen-a2a-python-sut target - AGENTS.md — document new emitter and commands - .gitignore — scope a2a-python ignore to root only TCK result: 76.5% compatibility (remaining failures are SDK-level). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Summary of ChangesHello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request significantly expands the A2A TCK's code generation capabilities by introducing a Python-based System Under Test (SUT) pipeline. This new feature allows for the automatic generation of runnable Python SUT projects from Gherkin scenarios, directly mirroring the existing Java SUT generation. The primary impact is enabling comprehensive conformance testing against the a2a-python SDK, ensuring broader compatibility and validation of the A2A specification across different language implementations. Highlights
Changelog
Activity
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request introduces a Python code emitter for generating an a2a-python SUT, which is a great addition mirroring the existing Java pipeline. The implementation is well-structured, with clear separation of concerns between parsing, model definition, and code generation. The new emitter is properly integrated with the build system and documented.
My main feedback is to modernize the asyncio server startup logic in the generated sut_agent.py file. The current implementation uses asyncio.get_event_loop(), which is deprecated. I've provided a suggestion to refactor this using asyncio.run(), which is the recommended approach for Python 3.7+ and will make the generated code more robust and future-proof.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The project requires Python >= 3.11 where get_event_loop() is deprecated. Use async def main() with asyncio.run() and add graceful gRPC shutdown. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request introduces a significant feature: a Python code emitter for generating a runnable SUT project from Gherkin scenarios, mirroring the existing Java pipeline. The implementation is well-structured, including the core emitter logic, Jinja2 templates, unit tests, and documentation. My review identifies a potential bug in the code generation for DataPartDef which could result in syntax errors in the generated code. I have also provided a suggestion to improve a command in the documentation to follow best practices. Overall, this is a strong contribution.
…ted code Use json_format.Parse() with a JSON string literal instead of json_format.ParseDict() with inline Python dict, which breaks on JSON values like null/true/false. Add ruff config to the generated pyproject.toml to suppress rules inherent to generated code (import order, unused imports, branch count). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
… code, refine skills - Use json_format.Parse() with a JSON string literal instead of json_format.ParseDict() with inline Python dict, fixing JSON null/true/false handling. - Add ruff config to generated pyproject.toml to suppress rules inherent to generated code (import order, unused imports, branch count). - Refine diagnose-failure, run-tck, and a2a-python-sut skills based on session learnings. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Add a Python code emitter that generates a runnable SUT project from Gherkin scenarios using the a2a-python SDK, mirroring the existing a2a-java pipeline. New files: - codegen/python_emitter.py — maps Actions to TaskUpdater API calls - codegen/a2a-python/*.j2 — Jinja2 templates (sut_agent.py, pyproject.toml) - tests/unit/codegen/test_python_emitter.py — 6 unit tests - sut/a2a-python/ — generated SUT project (16 scenarios) Modified: - codegen/generator.py — register a2a-python emitter - Makefile — add codegen-a2a-python-sut target - AGENTS.md — document new emitter and commands - .gitignore — scope a2a-python ignore to root only TCK result: 76.5% compatibility (remaining failures are SDK-level). --------- Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
Add a Python code emitter that generates a runnable SUT project from Gherkin scenarios using the a2a-python SDK, mirroring the existing a2a-java pipeline. New files: - codegen/python_emitter.py — maps Actions to TaskUpdater API calls - codegen/a2a-python/*.j2 — Jinja2 templates (sut_agent.py, pyproject.toml) - tests/unit/codegen/test_python_emitter.py — 6 unit tests - sut/a2a-python/ — generated SUT project (16 scenarios) Modified: - codegen/generator.py — register a2a-python emitter - Makefile — add codegen-a2a-python-sut target - AGENTS.md — document new emitter and commands - .gitignore — scope a2a-python ignore to root only TCK result: 76.5% compatibility (remaining failures are SDK-level). --------- Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
Add a Python code emitter that generates a runnable SUT project from Gherkin scenarios using the a2a-python SDK, mirroring the existing a2a-java pipeline. New files: - codegen/python_emitter.py — maps Actions to TaskUpdater API calls - codegen/a2a-python/*.j2 — Jinja2 templates (sut_agent.py, pyproject.toml) - tests/unit/codegen/test_python_emitter.py — 6 unit tests - sut/a2a-python/ — generated SUT project (16 scenarios) Modified: - codegen/generator.py — register a2a-python emitter - Makefile — add codegen-a2a-python-sut target - AGENTS.md — document new emitter and commands - .gitignore — scope a2a-python ignore to root only TCK result: 76.5% compatibility (remaining failures are SDK-level). --------- Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
Add a Python code emitter that generates a runnable SUT project from Gherkin scenarios using the a2a-python SDK, mirroring the existing a2a-java pipeline.
New files:
Modified:
TCK result: 76.5% compatibility (remaining failures are SDK-level).