fix(packaging): bundle scripts/python into the wheel core_pack (#3665)#3670
Merged
mnriem merged 1 commit intoJul 22, 2026
Merged
Conversation
…b#3665) `specify init --script py` generated skills that invoke `python3 .specify/scripts/python/<name>.py`, but the wheel's force-include list only carried `scripts/bash` and `scripts/powershell`. Installs from PyPI/Homebrew therefore shipped commands pointing at files that were never packaged, leaving `--script py` non-functional while `sh`/`ps` kept working. Force-include `scripts/python` alongside the other two variants, and add a contract test that asserts every script variant present in the repo is bundled, so a future variant cannot be dropped the same way. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Contributor
There was a problem hiding this comment.
Pull request overview
Bundles Python workflow scripts into wheel installations, fixing --script py.
Changes:
- Adds
scripts/pythonto wheel packaging. - Adds contract tests covering all script variants and #3665.
Show a summary per file
| File | Description |
|---|---|
pyproject.toml |
Includes Python scripts in core_pack. |
tests/contract/test_wheel_core_pack_scripts.py |
Guards wheel script packaging. |
Review details
Tip
Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Files reviewed: 2/2 changed files
- Comments generated: 0
- Review effort level: Medium
Collaborator
|
Thank you! |
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.
Fixes #3665.
Problem
specify init --script pygenerates command/skill files that invokepython3 .specify/scripts/python/<name>.py, but the released wheel never contained those scripts, so--script pyis non-functional on every install channel (PyPI, Homebrew).--script shand--script psare unaffected.Root cause
The wheel's
force-includelist inpyproject.tomlcarried onlyscripts/bashandscripts/powershellintospecify_cli/core_pack/. The installer resolves--script pyto the variant dirs("python", <platform shell>)and copies whatever variant directories exist in the bundle (shared_infra.py), so from a wheel thepython/variant was silently absent.Neither Python-scripts PR (#3302 PoC, #3386 port) touched
pyproject.toml— the port wired upshared_infra.py, the skill placeholder resolver, the command templates and ~1,800 lines of parity tests, but the packaging manifest was missed. Python scripts underextensions/*ship correctly only because those extensions are force-included as whole directories.Why CI didn't catch it
Every test runs from a source checkout, where
_locate_core_pack()returnsNoneand the repo-rootscripts/fallback resolvesscripts/python/normally. The parity and integration suites therefore pass against files the wheel does not contain, and nothing in CI built a wheel and inspected its contents.Fix
pyproject.toml: force-includescripts/pythonalongside the other two variants.tests/contract/test_wheel_core_pack_scripts.py: new contract test that enumeratesscripts/*in the repo and asserts each variant is force-included, plus an explicit [Bug]: --script py is broken — core scripts/python/*.py missing from the packaged wheel (core_pack) #3665 regression guard. It asserts againstpyproject.tomlrather than the filesystem, so it holds regardless of checkout vs. wheel — and a future fourth variant cannot be dropped the same way.Verification
core_pack/scripts/python/*.pypresent, no__pycache__leakage.specify init proj --script py --integration claude..specify/scripts/python/now lands with all five files, and every script path referenced by the generated skills exists on disk.create_new_feature.py --jsonandcheck_prerequisites.py --json --paths-onlyboth return the expected JSON contract.pyproject.tomlline reverted.Note for reviewers
--script pyalso installs the platform shell variant alongsidepython/(shared_infra.py), which is deliberate — the bundledagent-contextandgitextension command templates still hard-code shell invocations, as documented in the "Script Types and Migration" section ofAGENTS.md. This PR does not change that behavior; apyproject still receivesbash/(orpowershell/) in addition topython/.