Skip to content

Read a uv run Shebang as Python in the Prose Gate - #3676

Merged
ptr727 merged 2 commits into
developfrom
feature/3673-uv-run-shebang
Oct 30, 2026
Merged

ptr727 merged 2 commits into
developfrom
feature/3673-uv-run-shebang

Conversation

@ptr727

@ptr727 ptr727 commented Oct 30, 2026

Copy link
Copy Markdown
Owner

Summary

Fixes #3673. The prose gate picks an extensionless file's lexer from the program its shebang names. #!/usr/bin/env -S uv run --script names uv, which Pygments has no lexer for. So the file fell back to bash and missed every Python reading, including the PEP 723 metadata block exemption from #3634.

  • prose-gate.json gains files.runner, which maps a runner program to the interpreter it runs: { "uv": "python" }.
  • lexer_name looks up the shebang's program in that map before it asks Pygments.
  • Tests: four uv shebang forms select python, with and without -S and --script. An extensionless tool holding a PEP 723 block reports no comment-added. The file-mapping test now also checks that each runner value 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-review passes ran at the frontier tier. The first raised one introduced finding: 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

ptr727 and others added 2 commits October 30, 2026 14:40
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>
Copilot AI lite review requested due to automatic review settings October 30, 2026 21:45
@coderabbitai

coderabbitai Bot commented Oct 30, 2026

Copy link
Copy Markdown

Important

  • 🔍 Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

Run configuration
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@ptr727

ptr727 commented Oct 30, 2026

Copy link
Copy Markdown
Owner Author

A recorded local strict-review pass covers head 5ac8f52c88965b5ed3550a6cfe0eea682084ac95, the content this pull request carries at that commit against develop, and it recorded 0 findings.

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.

🟢 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-python runner mapping in the prose-gate configuration.
  • Applies runner mappings when selecting the shebang lexer.
  • Adds tests for supported uv shebang 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

codecov Bot commented Oct 30, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 81.72%. Comparing base (e8ea7b1) to head (5ac8f52).

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           
Flag Coverage Δ
python-3.13 81.72% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@ptr727
ptr727 merged commit 90813a0 into develop Oct 30, 2026
14 checks passed
@ptr727
ptr727 deleted the feature/3673-uv-run-shebang branch October 30, 2026 21:58
ptr727 added a commit that referenced this pull request Oct 30, 2026
…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)
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.

2 participants