Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Python3 shebang #182

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Add Python3 shebang #182

wants to merge 1 commit into from

Conversation

abitrolly
Copy link
Contributor

No description provided.

@mhagger
Copy link
Owner

mhagger commented Apr 26, 2021

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
Copy link
Contributor Author

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

@jdufresne
Copy link
Contributor

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
Copy link
Contributor Author

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
Copy link
Contributor Author

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

@jdufresne
Copy link
Contributor

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
Copy link
Contributor Author

@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
Copy link
Contributor

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
Copy link
Contributor Author

@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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants