Skip to content

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

Closed

Description

@ptr727

Defect

The prose gate picks an extensionless file's lexer from its shebang, taking the program env runs. The shebang uv documents for a standalone script is #!/usr/bin/env -S uv run --script, and that names uv, which Pygments has no lexer for. The file then falls back to the extensionless lexer, bash, and is read with the hash language data rather than the python data.

A constructed case, saved as an extensionless file named tool:

#!/usr/bin/env -S uv run --script
# /// script
# requires-python = ">=3.13"
# ///
value = 1

comment-added reports lines 2 and 3 there, since the hash data declares no metadata_block. The same text saved as tool.py reports nothing. Every other Python-only reading misses that file as well, its docstrings and trailing directives among them.

lexer_name in .github/actions/prose-gate/prose_lint.py makes the choice. Its shebang branch skips env's options, -S included, and looks up the program after them, which is uv rather than the interpreter uv runs.

Done Means

  • A shebang running a Python script through uv run, with or without -S and --script, selects the Python lexer.
  • A test reads that extensionless file with the PEP 723 block above and reports no comment-added finding.

Found by the local review of the #3634 fix, and left out of that change since the lexer choice predates it.

Activity

  1. added
    gateA rule with no mechanical check, or a check that misses a shape
    scriptA defect in hub tooling
    pre-existingReview finding classed pre-existing per local-strict-review Disposing of Findings
    on Oct 30, 2026
  2. added a commit that references this issue on Oct 30, 2026
    b19bf38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    gateA rule with no mechanical check, or a check that misses a shapepre-existingReview finding classed pre-existing per local-strict-review Disposing of FindingsscriptA defect in hub tooling

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions