#6565·xonsh

Reconsider disallowing bare scripts to be inferred as xonsh

Author: jaracoCreated Aug 6, 2026Updated Aug 11, 2026

This change introduced a regression in my environment (jaraco/jaraco.xonsh#2). I'd like to suggest different behavior than what was introduced in this PR:

  • When there is no extension, infer the shell from the shebang
    • i.e. a script without an extension but with a first line of #!/usr/bin/env bash will be treated as bash.
  • When there is no extension and no shebang, assume xonsh. Because we're using the xonsh shell, xonsh should have primacy.
  • Add a different option to opt-in to the "extension required" behavior (or re-use -e, but that would a backward-incompatible change).

Originally posted by @jaraco in https://github.com/xonsh/xonsh/issues/5938#issuecomment-5205309356