Repository navigation
Accept Python interpreters selected by nix-shell (EXE003) - #95
Open
LisaScheers wants to merge 2 commits into
Open
LisaScheers wants to merge 2 commits into
LisaScheers wants to merge 2 commits into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Python scripts launched through
nix-shellcurrently trigger EXE003 even when a subsequent#! nix-shell -i python3directive selects Python. This is documented usage in the Nix reference manual:Recognize the Python interpreter selected by these directives when the initial shebang invokes
nix-shell, either directly or throughenv. Options can span multiple directive lines and include quoted arguments. A Python package alone does not qualify, and the last-idetermines the interpreter. Missing, malformed, or non-Python interpreter options retain EXE003; executable permission and shebang placement checks remain active.For context, Linux
execve(2)describes the first-line interpreter directive and explicitly notes that POSIX does not specify shebang behavior. Python's lexical specification permits the subsequent lines as comments, which Nix reads as options. EXE005 already ignores those subsequent lines upstream; this fixes the separate EXE003 rejection.Test plan
nix-shellenvironment.envinvocation, non-Python/missing/malformed interpreters, lookalike commands, misplaced shebangs, and executable permissions.Assisted by an LLM using
GPT-6inCodex.