New GitHub issue #118673 from jaraco:<br>

<hr>

<pre>
# Feature or enhancement

### Proposal:

In https://github.com/jaraco/backports.tarfile/issues/4, I discovered that the presence of a shebang and executable bit on the `tarfile` module signals to downstream packagers and users that the module can be treated like a script and executed directly. That expectation seems to stem from an incidental artifact of the original contribution happening to have been written as a script. In fact, back in those days, many developers including myself would add `#!/usr/bin/env python` to a Python file just to signal that the syntax was Python, so it may never have been intended to be executed directly.

Nevertheless, the presence of the shebang led to it being marked as executable in #64135.

Marking this module as executable prevents the module from ever being ported to a package (such as `backports.tarfile` does) without breaking that assumption. It also tempts users to execute a module with the incorrect Python version. Instead, users should be directed to runpy invocation (i.e. `python -m tarfile`).

This proposal only includes tarfile in the scope, but it also implies that other modules changed in #64135 should also have their shebangs removed except where explicitly desired (and presumably documented or tested as such).

### Has this already been discussed elsewhere?

This is a minor feature, which does not need previous discussion elsewhere

### Links to previous discussion of this feature:

_No response_
</pre>

<hr>

<a href="https://github.com/python/cpython/issues/118673">View on GitHub</a>
<p>Labels: type-feature</p>
<p>Assignee: </p>