Repository navigation
Read a uv run Shebang as Python in the Prose Gate - #3676
Conversation
The prose gate picked an extensionless file's lexer from the program its shebang names, and `uv` has no Pygments lexer, so a `uv run --script` file fell back to `bash` and missed every Python reading, the PEP 723 metadata block exemption among them. A `runner` map in the data names the interpreter a runner runs, and `lexer_name` looks the program up there before asking Pygments. Closes #3673 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Important
This repository does not receive automatic reviews because it has fewer than 10 stars.
|
|
A recorded local strict-review pass covers head |
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues are reported for the change.
No open issues 🎉
What changed in this PR
Updates the prose gate to recognize extensionless scripts using uv run shebangs as Python, preserving Python-specific checks such as PEP 723 metadata exemptions.
Changes:
- Adds a
uv-to-pythonrunner mapping in the prose-gate configuration. - Applies runner mappings when selecting the shebang lexer.
- Adds tests for supported
uvshebang forms, metadata handling, and mapping validation.
| File | Description |
|---|---|
tests/test_prose_lint.py |
Tests uv shebang resolution, PEP 723 metadata handling, and runner mapping validation. |
.github/actions/prose-gate/prose-gate.json |
Declares uv as a Python runner. |
.github/actions/prose-gate/prose_lint.py |
Resolves mapped runner programs before selecting the Pygments lexer. |
Review effort: Lite
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## develop #3676 +/- ##
========================================
Coverage 81.72% 81.72%
========================================
Files 27 27
Lines 9128 9128
========================================
Hits 7460 7460
Misses 1668 1668
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
…3678) Promotes the changes merged into `develop` since promotion #3675 to `main`. - [#3676](#3676) Reads a `uv run` shebang as Python in the prose gate. A new `files.runner` map in the gate's data names the interpreter a runner runs, so an extensionless `uv run --script` file gets the Python reading, the PEP 723 metadata block exemption among it. Closes #3673 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Summary
Fixes #3673. The prose gate picks an extensionless file's lexer from the program its shebang names.
#!/usr/bin/env -S uv run --scriptnamesuv, which Pygments has no lexer for. So the file fell back tobashand missed every Python reading, including the PEP 723 metadata block exemption from #3634.prose-gate.jsongainsfiles.runner, which maps a runner program to the interpreter it runs:{ "uv": "python" }.lexer_namelooks up the shebang's program in that map before it asks Pygments.uvshebang forms selectpython, with and without-Sand--script. An extensionlesstoolholding a PEP 723 block reports nocomment-added. The file-mapping test now also checks that eachrunnervalue names a declared language.Both new tests fail when the lookup is removed. The 644 prose-lint tests pass, and so do ruff, mypy, the prose gate, and the eol gate.
Local review
Two
local-strict-reviewpasses ran at thefrontiertier. The first raised oneintroducedfinding: the mapping test did not cover the new map. That was fixed in 5ac8f52. The second pass over the full diff raised nothing.🤖 Generated with Claude Code