Commit 5e524ce
authored
Fix invalid PEP 723 header in new-script template (#1514)
I was reading PEP723 specs trying to understand the scope for supporting
it in envs extension and noticed that the header is invalid in the
template, so sending the PR to fix it.
## Summary
The script template shipped under
`files/templates/new723ScriptTemplate/script.py` opens with `# ///
script_name`, which is **not** a valid PEP 723 inline-script metadata
header — the
[spec](https://packaging.python.org/en/latest/specifications/inline-script-metadata/)
mandates the literal type `script`. Compounding this,
[newScriptProject.ts](src/features/creators/newScriptProject.ts)
substitutes the user's filename into that token at create-time,
producing further invalid headers like `# /// my_script`. This PR
replaces the template's first line with the literal `# /// script` so
the generated script is recognized by every PEP 723–compliant tool, and
adds a unit test that locks the behaviour in.1 parent eea3e13 commit 5e524ce
2 files changed
Lines changed: 45 additions & 1 deletion
File tree
- files/templates/new723ScriptTemplate
- src/test/features/creators
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
| 1 | + | |
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
0 commit comments