Skip to content

feat(scripts): add Python check-prerequisites PoC#3302

Merged
mnriem merged 3 commits into
github:mainfrom
WOLIKIMCHENG:feat-python-check-prerequisites-poc
Jul 6, 2026
Merged

feat(scripts): add Python check-prerequisites PoC#3302
mnriem merged 3 commits into
github:mainfrom
WOLIKIMCHENG:feat-python-check-prerequisites-poc

Conversation

@WOLIKIMCHENG

Copy link
Copy Markdown
Contributor

Description

Adds a Python proof-of-concept implementation for check-prerequisites as part of #3279.

Scope:

  • adds scripts/python/common.py with the helper subset needed by this script
  • adds scripts/python/check_prerequisites.py
  • adds parity tests against the existing Bash and PowerShell behavior
  • does not switch command templates or runtime usage to Python

This 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 -q
  • uvx ruff check scripts/python tests/test_check_prerequisites_python_parity.py
  • git diff --check

Copilot AI 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.

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.py with Python equivalents of the subset of shared helpers needed for prerequisite/path resolution.
  • Added scripts/python/check_prerequisites.py implementing check-prerequisites flag behavior in Python.
  • Added tests/test_check_prerequisites_python_parity.py to 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 thread scripts/python/common.py
Comment thread tests/test_check_prerequisites_python_parity.py Outdated
Comment thread tests/test_check_prerequisites_python_parity.py

@mnriem mnriem left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Please address Copilot feedback

@WOLIKIMCHENG

WOLIKIMCHENG commented Jul 3, 2026

Copy link
Copy Markdown
Contributor Author

Addressed the requested feedback:

  • get_repo_root() now searches from the script location for the nearest .specify root before using the installed-layout fallback.
  • Added regression coverage for running the repo-copy Python script from outside the repo.
  • Strengthened Bash/Python help parity to compare the full normalized help output.
  • Expanded PowerShell JSON parity coverage to the same flag combinations as the Bash JSON matrix.

Validation:

  • .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
  • uvx ruff check scripts/python tests/test_check_prerequisites_python_parity.py
  • git diff --check

Copilot AI 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.

Review details

  • Files reviewed: 3/3 changed files
  • Comments generated: 0 new
  • Review effort level: Low

@mnriem mnriem self-requested a review July 6, 2026 22:54
@mnriem mnriem merged commit 73f77c2 into github:main Jul 6, 2026
12 checks passed
@mnriem

mnriem commented Jul 6, 2026

Copy link
Copy Markdown
Collaborator

Thank you!

mnriem pushed a commit that referenced this pull request Jul 8, 2026
* feat(extensions): port update-agent-context to Python

Ports the agent-context extension updater to a single Python script,
per #3281 and the check-prerequisites PoC pattern from #3302. The bash
version already ran its core logic through embedded Python heredocs, so
the port lifts that logic into a standalone script. Parity tests run
bash and Python side by side and compare output and resulting
context-file bytes.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* fix(extensions): match bash case-insensitivity on MSYS, test unparseable config gate

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

---------

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
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.

PoC: port check-prerequisites to Python with output-parity tests

3 participants