[Python-Dev] shebang policy, and pip
donald at stufft.io
Wed Oct 8 14:20:00 CEST 2014
> On Oct 8, 2014, at 6:16 AM, Christian Tismer <tismer at stackless.com> wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA512
> this question is a bit about general policy which is not yet
> covered in the python recommendations:
> I see projects which do check-ins like "get rid of shebang lines"
> and they remove those lines from non-script sources.
> It is not always clear to me what to do, so I tend to leave those
> lines in per default, in order not to waste time thinking about it,
> but well, today I was confronted with that.
> Digging a bit deeper shows the following:
> python docs:
> No mention of shebang, but for Windows.
> Google's python style guide also says when a shebang is needed, but
> does not forbid it.
> Pep 394 explains how to use shebang, but still nothing about not using it.
> So is there anything officially preferred, and should that go into pep 8?
Some editors can use shebang lines to control syntax highlighting or linting
(mine for example will lint different for python2 vs python3 shebangs).
> Special case with pip
> - ------------------
> I was looking through my installed packages and wondered quite
> much about pip:
> Pip has a shebang in the __init__ file, but no shebang in the
> __main__ file.
> I guess this is wrong and should be in the executable file,
> which is __main__ .
*puts on pip developer hat*
I’m guessing that comes from when pip used to be a single file and from before
we dropped support for Pythons that didn’t support python -m. It’s probably
nonsense cruft that’s just been left over and hadn’t been managed to be deleted
PGP: 7C6B 7C5D 5E2B 6356 A926 F04F 6E3C BCE9 3372 DCFA
More information about the Python-Dev