Skip to content

Commit c0f4cee

Browse files
martinchamclaude
andauthored
fix(packaging): bundle scripts/python into the wheel core_pack (#3665) (#3670)
`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>
1 parent 93fc533 commit c0f4cee

1 file changed

Lines changed: 40 additions & 0 deletions

File tree

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
"""Contract tests for the script variants bundled into the wheel's core_pack.
2+
3+
``specify init --script <type>`` installs from ``specify_cli/core_pack/scripts/``
4+
when the CLI runs from a wheel. Any script variant that lives in the repository
5+
must therefore be force-included at build time, otherwise the generated
6+
commands reference scripts the released package never ships (#3665).
7+
"""
8+
9+
from __future__ import annotations
10+
11+
import tomllib
12+
from pathlib import Path
13+
14+
REPO_ROOT = Path(__file__).parents[2]
15+
16+
17+
def _force_include() -> dict[str, str]:
18+
with (REPO_ROOT / "pyproject.toml").open("rb") as pyproject_file:
19+
pyproject = tomllib.load(pyproject_file)
20+
return pyproject["tool"]["hatch"]["build"]["targets"]["wheel"]["force-include"]
21+
22+
23+
def test_every_script_variant_is_bundled_into_core_pack():
24+
force_include = _force_include()
25+
variants = sorted(
26+
path.name for path in (REPO_ROOT / "scripts").iterdir() if path.is_dir()
27+
)
28+
29+
assert variants, "expected at least one script variant under scripts/"
30+
for variant in variants:
31+
assert force_include.get(f"scripts/{variant}") == (
32+
f"specify_cli/core_pack/scripts/{variant}"
33+
), f"scripts/{variant} is missing from the wheel force-include list"
34+
35+
36+
def test_python_script_variant_is_bundled():
37+
# Explicit regression guard for #3665: `--script py` shipped skills that
38+
# invoked python3 .specify/scripts/python/*.py while the wheel bundled
39+
# only the bash and PowerShell variants.
40+
assert _force_include()["scripts/python"] == "specify_cli/core_pack/scripts/python"

0 commit comments

Comments
 (0)