mhagger / git-imerge

Incremental merge for git
GNU General Public License v2.0
2.68k stars 126 forks source link

Add Python3 shebang #182

Open abitrolly opened 3 years ago

mhagger commented 3 years ago

My understanding was that python setup.py install would somehow arrange for this to be invoked as a module by the correct python interpreter. @jdufresne do you have an opinion about whether a shebang line would be beneficial?

abitrolly commented 3 years ago

Not sure if that's true for Linux. I just run it from source with my dirty hacks and system interpreter.

jdufresne commented 3 years ago

My understanding was that python setup.py install would somehow arrange for this to be invoked as a module by the correct python interpreter. @jdufresne do you have an opinion about whether a shebang line would be beneficial?

Yes, that is correct. Hard coding the Python path is unnecessary and discouraged with modern setuptools entry points.

@abitrolly If you want to run if from source, do python3 gitimerge.py or use your preferred Python path.

If you want it to be self executing, please install it using pip or setuptools.

abitrolly commented 3 years ago

Yes, that is correct. Hard coding the Python path is unnecessary and discouraged with modern setuptools entry points.

It is not hardcoding, because it uses /usr/bin/env. And I would be interested to see a proof link where shebangs are discouraged in favor of setuptools installation process. If I remember correctly setuptools writes its own launcher script for entrypoints without relying on shebang in imported file.

If you want it to be self executing, please install it using pip or setuptools.

What is the benefit of installing it if it works without installing?

abitrolly commented 3 years ago

@jdufresne so can you provide a reference explaining why shebangs are discouraged?

jdufresne commented 3 years ago

The shebang is added by setuptools, there is no need to hardcode it. Setuptools handles Python running from any environment, be it system, virtualenv, or an unusual custom installation.

abitrolly commented 3 years ago

@jdufresne setuptools doesn't modify source code. It creates its own launcher scripts, which use Python import mechanism, which means that this change doesn't conflict with setuptools.

jdufresne commented 3 years ago

It creates its own launcher scripts

Correct. Please use the setuptools CLI entry point or python -m gitimerge to run the program after installation.

abitrolly commented 3 years ago

@jdufresne why are you insist on installation? The package runs fine from sources, allows to easily modify it without setuptools, virtualenv and entrypoints. I understand that maybe you've had some traumatic experience without setuptools, but so do I when I am forced to install scripts that work perfectly fine without installation. It should be sufficient that shebang doesn't break anything.