[Python-Dev] shebang policy, and pip
-BEGIN PGP SIGNED MESSAGE- Hash: SHA512 Howdy, 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. https://docs.python.org/3/search.html?q=shebangcheck_keywords=yesarea=default https://docs.python.org/3/using/windows.html?highlight=shebang 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. http://legacy.python.org/dev/peps/pep-0394/ So is there anything officially preferred, and should that go into pep 8? 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__ . cheers - Chris - -- Christian Tismer :^) tis...@stackless.com Software Consulting : http://www.stackless.com/ Karl-Liebknecht-Str. 121 : http://www.pydica.net/ 14482 Potsdam: GPG key - 0xFB7BEE0E phone +49 173 24 18 776 fax +49 (30) 700143-0023 -BEGIN PGP SIGNATURE- Version: GnuPG/MacGPG2 v2.0.22 (Darwin) Comment: GPGTools - https://gpgtools.org iQEcBAEBCgAGBQJUNQ8FAAoJEOcwEVD7e+4Of5MH/13YyXRzPVXfsLDbfe/CRkFF ORVAPkRB90OaEmbLTvBXPhFlAgEwcQnpdO+tmqigvlORd0cSXQKIxoPOiqq601gs XV56aREqBCT26XMaKTuoPdu4DaW+TkwyWSn70eq4U/P7YjF3ZlNt8IkA5mteM7an ycRYMnknEaIvP/xpZdGp+v4pq5LA42LWAY1awnBk4eMP04uDowSmcuLELpZrmSCr iMkw6wPUdZxGVtQNwSses0mh3DuaQuwrubhHMnLoOKn/lqRjckG2Ii2BIHlWy9lQ 5X3y8IdWPh7awio8xaibNqsWaP+0DT97g2H7QZf8YIG7/DkHL/iacSr7NAPBXXQ= =IODc -END PGP SIGNATURE- ___ Python-Dev mailing list Python-Dev@python.org https://mail.python.org/mailman/listinfo/python-dev Unsubscribe: https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com
Re: [Python-Dev] shebang policy, and pip
On Oct 8, 2014, at 6:16 AM, Christian Tismer tis...@stackless.com wrote: -BEGIN PGP SIGNED MESSAGE- Hash: SHA512 Howdy, 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. https://docs.python.org/3/search.html?q=shebangcheck_keywords=yesarea=default https://docs.python.org/3/using/windows.html?highlight=shebang 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. http://legacy.python.org/dev/peps/pep-0394/ 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 now. --- Donald Stufft PGP: 7C6B 7C5D 5E2B 6356 A926 F04F 6E3C BCE9 3372 DCFA ___ Python-Dev mailing list Python-Dev@python.org https://mail.python.org/mailman/listinfo/python-dev Unsubscribe: https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com
Re: [Python-Dev] shebang policy, and pip
On Oct 8, 2014, at 3:36 PM, Wes Turner wes.tur...@gmail.com wrote: On Oct 8, 2014 7:20 AM, Donald Stufft don...@stufft.io mailto:don...@stufft.io wrote: On Oct 8, 2014, at 6:16 AM, Christian Tismer tis...@stackless.com mailto:tis...@stackless.com wrote: -BEGIN PGP SIGNED MESSAGE- Hash: SHA512 Howdy, 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. https://docs.python.org/3/search.html?q=shebangcheck_keywords=yesarea=default https://docs.python.org/3/search.html?q=shebangcheck_keywords=yesarea=default https://docs.python.org/3/using/windows.html?highlight=shebang https://docs.python.org/3/using/windows.html?highlight=shebang 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. http://legacy.python.org/dev/peps/pep-0394/ http://legacy.python.org/dev/peps/pep-0394/ 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). Does it support shebang lines like: #!/usr/bin/env python ? Sure. Though it doesn’t resolve it to determine what that would actually execute, it just uses the name of the python in the shebang as heuristics. --- Donald Stufft PGP: 7C6B 7C5D 5E2B 6356 A926 F04F 6E3C BCE9 3372 DCFA ___ Python-Dev mailing list Python-Dev@python.org https://mail.python.org/mailman/listinfo/python-dev Unsubscribe: https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com
Re: [Python-Dev] shebang policy, and pip
-BEGIN PGP SIGNED MESSAGE- Hash: SHA512 On 08.10.14 14:20, Donald Stufft wrote: On Oct 8, 2014, at 6:16 AM, Christian Tismer tis...@stackless.com wrote: ... 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). Interesting use case, of course! At first sight, at least ;-) But it becomes relatively awkward when virtualenv is used: There is no textual distinction between python 2 and 3, and the text editor would have to do more analysis to get things right than to guess from the shebang line. Which then makes it useless, and the editor would need to grab the real python interpreter to find things out. cheers - Chris - -- Christian Tismer :^) tis...@stackless.com Software Consulting : http://www.stackless.com/ Karl-Liebknecht-Str. 121 : http://www.pydica.net/ 14482 Potsdam: GPG key - 0xFB7BEE0E phone +49 173 24 18 776 fax +49 (30) 700143-0023 -BEGIN PGP SIGNATURE- Version: GnuPG/MacGPG2 v2.0.22 (Darwin) Comment: GPGTools - https://gpgtools.org iQEcBAEBCgAGBQJUNZV1AAoJEOcwEVD7e+4OlpcIAN3556PP4sBlFeDDPn4bq3fO ScXRhB8tPkS3Ftgyux2swE91yxOZFSV8Zyae04wTB+GlzKZ6v9aXMKn5mt+b6sIr aq1vfPxG7Qoz3q7zhaAfps8ErD9f1PriC7/4F2P4FOOko07eHt6/e8Sxg4qAgMPz nADLj8/2MtvQYFiw3m4Zsqs31wjCTTICH52FnRgla9+u5IhStdQE7OFTiHZaPNK3 tsUohUoKqhMPIhwuB669JE7rwcRB9dA5Iatiy3uU0wqCYkekT3I4DwCtAS+DZkJX Fe0wpLGGHOprwUTQu0SMFGQRxPX3HxL0RzTNLKjCcDNLDWRcwZRPOZ3K4DVoggQ= =i5dg -END PGP SIGNATURE- ___ Python-Dev mailing list Python-Dev@python.org https://mail.python.org/mailman/listinfo/python-dev Unsubscribe: https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com
Re: [Python-Dev] shebang policy, and pip
On Oct 8, 2014 7:20 AM, Donald Stufft don...@stufft.io wrote: On Oct 8, 2014, at 6:16 AM, Christian Tismer tis...@stackless.com wrote: -BEGIN PGP SIGNED MESSAGE- Hash: SHA512 Howdy, 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. https://docs.python.org/3/search.html?q=shebangcheck_keywords=yesarea=default https://docs.python.org/3/using/windows.html?highlight=shebang 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. http://legacy.python.org/dev/peps/pep-0394/ 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). Does it support shebang lines like: #!/usr/bin/env python ? ___ Python-Dev mailing list Python-Dev@python.org https://mail.python.org/mailman/listinfo/python-dev Unsubscribe: https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com
Re: [Python-Dev] shebang policy, and pip
On Oct 08, 2014, at 08:20 AM, Donald Stufft wrote: Some editors can use shebang lines to control syntax highlighting or linting (mine for example will lint different for python2 vs python3 shebangs). Some editors can also use `# -*- foo -*-` comments to set up editing modes and there are other ways to specify which version linters to use. I generally avoid shebangs where they aren't needed, and between entry points and -m they rarely are these days. I find most uses are in smaller one-off scripts and such. Cheers, -Barry signature.asc Description: PGP signature ___ Python-Dev mailing list Python-Dev@python.org https://mail.python.org/mailman/listinfo/python-dev Unsubscribe: https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com