Conversation
Co-authored-by: spboyer <7681382+spboyer@users.noreply.github.com>
Co-authored-by: spboyer <7681382+spboyer@users.noreply.github.com>
Co-authored-by: spboyer <7681382+spboyer@users.noreply.github.com>
There was a problem hiding this comment.
Pull Request Overview
This PR implements Phase 3 of the pycontainer-build roadmap, adding comprehensive toolchain integrations to enable Docker-free container builds across the Python ecosystem. The implementation includes Poetry and Hatch plugins, a VS Code extension, reusable GitHub Actions workflow, Azure Developer CLI integration documentation, and a complete FastAPI example demonstrating all integrations.
Key Changes:
- Native Poetry plugin enabling
poetry build-containercommand with[tool.pycontainer]configuration - Hatch build hook that automatically creates containers during
hatch build - VS Code extension with command palette integration, real-time output, and configuration wizard
- Reusable GitHub Actions workflow with matrix build support and GHCR authentication
- Comprehensive Azure Developer CLI integration guide with multi-service examples
- Complete FastAPI demo application showing all integration methods
Reviewed Changes
Copilot reviewed 27 out of 28 changed files in this pull request and generated 12 comments.
Show a summary per file
| File | Description |
|---|---|
| plugins/poetry-pycontainer/* | Poetry plugin implementation with CLI command and pyproject.toml config support |
| plugins/hatch-pycontainer/* | Hatch build hook for automatic container creation during package builds |
| plugins/vscode-pycontainer/* | TypeScript-based VS Code extension with UI commands and output channel |
| .github/workflows/pycontainer-build.yml | Reusable workflow with configurable inputs for CI/CD integration |
| docs/github-actions.md | Comprehensive guide with 4 use cases and authentication patterns |
| docs/azd-integration.md | Detailed Azure Developer CLI integration with multi-service examples |
| examples/fastapi-app/* | Working FastAPI demo showing all integration methods |
| plugins/README.md | Overview comparing all plugins with installation and usage guides |
| PHASE3_*.md | Implementation summary and completion documentation |
| README.md | Updated with integrations section and links to all plugins |
| let command = `${pythonPath} -m pycontainer build --tag ${tag} --base-image ${baseImage}`; | ||
|
|
||
| if (push) { | ||
| command += ' --push'; | ||
| } | ||
|
|
||
| if (verbose) { | ||
| command += ' --verbose'; | ||
| } |
There was a problem hiding this comment.
The command construction uses unsanitized user input from vscode.window.showInputBox() directly in a shell command. The tag variable (line 43-46) is directly concatenated into the command string without validation or escaping.
This could allow command injection if a user enters a malicious tag like:
myapp; rm -rf /
Recommend using proper argument escaping or passing arguments as an array to child_process.spawn() instead of child_process.exec() with a concatenated string.
There was a problem hiding this comment.
Fixed in commit 3af6982. Replaced all child_process.exec() calls with child_process.spawn() using argument arrays to prevent command injection. This applies to buildContainer(), installPycontainer(), and checkPycontainerInstalled() functions.
| proc.stdout?.on('data', (data) => { | ||
| outputChannel.append(data.toString()); | ||
| }); | ||
|
|
||
| proc.stderr?.on('data', (data) => { | ||
| outputChannel.append(data.toString()); | ||
| }); |
There was a problem hiding this comment.
Duplicate output handling. The proc.stdout?.on('data') handler at line 109 will append data to the output channel, but the callback at line 80-107 also appends stdout at line 91-92. This means stdout will be printed twice in the output channel.
Either remove lines 109-115, or remove the stdout/stderr handling in lines 91-97 of the callback.
There was a problem hiding this comment.
Fixed in commit 3af6982. The refactor to use child_process.spawn() eliminates the duplicate output handling - stdout/stderr are now only handled by the stream event handlers.
| [tool.pycontainer] | ||
| tag = "fastapi-demo:latest" | ||
| base_image = "python:3.11-slim" | ||
| include_deps = true | ||
|
|
||
| [tool.pycontainer.env] | ||
| ENV = "production" | ||
| LOG_LEVEL = "info" | ||
|
|
||
| [tool.pycontainer.labels] | ||
| maintainer = "demo@example.com" | ||
| description = "FastAPI demo application" | ||
|
|
||
| # Hatch plugin configuration | ||
| [tool.hatch.build.hooks.pycontainer] | ||
| tag = "fastapi-demo:latest" | ||
| base-image = "python:3.11-slim" | ||
| include-deps = true | ||
|
|
||
| [tool.hatch.build.hooks.pycontainer.env] | ||
| ENV = "production" | ||
| LOG_LEVEL = "info" |
There was a problem hiding this comment.
Configuration duplication between Poetry and Hatch sections (lines 21-32 vs 35-42). The same configuration is repeated with only minor syntax differences (base_image vs base-image).
If this example is meant to show both can coexist, consider adding a comment explaining why both are present. Otherwise, this duplication could confuse users about which section to use.
There was a problem hiding this comment.
Added explanatory comment in commit 3af6982. The comment clarifies that both configurations are shown for demonstration purposes, and in real projects you would only include the section for your chosen tool.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
|
@copilot apply changes based on the comments in this thread |
…nd add example comment Co-authored-by: spboyer <7681382+spboyer@users.noreply.github.com>
All issues from the review thread have already been addressed in previous commits (f71eefa, 2b589f1, dd9fced, 8bcb804, 46c03a6, 55a211a, 931e2c3, and 3af6982): ✅ Poetry plugin boolean logic fixed (three-state checks) No additional changes needed. |
|
@copilot can you review again for any needed changes |
Reviewed all code - no changes needed. All previous issues have been successfully addressed: Poetry Plugin ( Hatch Plugin ( VS Code Extension ( GitHub Actions ( Example ( Code is production-ready. |
Phase 3: Toolchain Integrations - COMPLETE ✅
All Phase 3 milestones have been successfully delivered with comprehensive implementations, documentation, and examples.
Latest Changes (Addressing PR Review Feedback)
Security & Bug Fixes:
project.entry-pointsfor setuptools)icon.pngreference from VS Code extension package.jsonchild_process.exectochild_process.spawnwith proper argument arraysSecurity Improvements
The VS Code extension now uses
child_process.spawn()with argument arrays instead of string concatenation, preventing command injection attacks:Before (vulnerable):
After (secure):
This applies to all three functions:
buildContainer(),installPycontainer(), andcheckPycontainerInstalled().Completed Milestones
poetry build-containercommandFiles Changed
plugins/poetry-pycontainer/pyproject.toml- Fixed entry point configurationplugins/vscode-pycontainer/package.json- Removed missing icon referenceplugins/vscode-pycontainer/src/extension.ts- Fixed command injection vulnerability and duplicate handlersexamples/fastapi-app/pyproject.toml- Added explanatory commentAll changes have been validated and are ready for review.
Original prompt
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.