feat(scripts): add Python check-prerequisites PoC#3302
Open
WOLIKIMCHENG wants to merge 1 commit into
Open
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR adds a Python proof-of-concept implementation of the existing check-prerequisites script, along with a minimal Python common.py helper module and new tests intended to validate output parity against the existing Bash/PowerShell implementations (without switching any runtime templates over to Python yet).
Changes:
- Added
scripts/python/common.pywith Python equivalents of the subset of shared helpers needed for prerequisite/path resolution. - Added
scripts/python/check_prerequisites.pyimplementingcheck-prerequisitesflag behavior in Python. - Added
tests/test_check_prerequisites_python_parity.pyto compare Python output against Bash (and partially against PowerShell).
Show a summary per file
| File | Description |
|---|---|
| tests/test_check_prerequisites_python_parity.py | Adds parity-oriented tests comparing Python output with Bash (and a limited PowerShell case). |
| scripts/python/common.py | Introduces shared Python helpers for repo-root and feature-path resolution plus command formatting. |
| scripts/python/check_prerequisites.py | Implements the Python PoC of prerequisite checking and JSON/text/path-only outputs. |
Review details
Tip
Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Files reviewed: 3/3 changed files
- Comments generated: 3
- Review effort level: Low
Comment on lines
+67
to
+70
| if script_file is not None: | ||
| # Installed scripts live at .specify/scripts/python/<script>.py. | ||
| return script_file.resolve().parents[3] | ||
| return Path.cwd().resolve() |
Comment on lines
+179
to
+183
| for flag in [ | ||
| "--json", | ||
| "--require-tasks", | ||
| "--include-tasks", | ||
| "--paths-only", |
Comment on lines
+201
to
+205
| @pytest.mark.skipif(not (HAS_PWSH or _WINDOWS_POWERSHELL), reason="no PowerShell available") | ||
| def test_python_json_output_matches_powershell(prereq_repo: Path) -> None: | ||
| feat = prereq_repo / "specs" / "001-my-feature" | ||
| feat.mkdir(parents=True) | ||
| (feat / "plan.md").write_text("# plan\n", encoding="utf-8") |
mnriem
requested changes
Jul 2, 2026
mnriem
left a comment
Collaborator
There was a problem hiding this comment.
Please address Copilot feedback
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Adds a Python proof-of-concept implementation for
check-prerequisitesas part of #3279.Scope:
scripts/python/common.pywith the helper subset needed by this scriptscripts/python/check_prerequisites.pyThis preserves the existing shell scripts and keeps activation for follow-up issues.
Fixes #3279
Testing
.venv/bin/python -m pytest tests/test_check_prerequisites_python_parity.py -q.venv/bin/python -m pytest tests/test_check_prerequisites_paths_only.py -q.venv/bin/python -m pytest tests/test_setup_tasks.py -quvx ruff check scripts/python tests/test_check_prerequisites_python_parity.pygit diff --check