-
-
Notifications
You must be signed in to change notification settings - Fork 258
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
--python vs --python-shebang #1095
Comments
1st, correcting your example: For convenient reference, the help for the
On to shebang questions, with the help again for convenient reference:
The fundamental missing context appears to be how binaries get executed on Unix; so I'll lead with that: Traditionally, on Unix, a file is executable if the appropriate mode bits are set and the contents is either a known executable file format (ELF, COFF, ... depends on the Unix) or else its a script. A script is denoted by
The only special thing here with respect to Python is the Python interpreter knows how to "run" a zip file and zipfiles allow arbitrary leading content to be inserted at the head of the zipfile; so Python scripts can be packaged as a zipfile and a PEX is a zipfile that leverages all this: Now, you may have noticed that the shebang is host-dependant in that you must know the exact absolute path to the script interpreter to run. In example 4, reliance on the path of the You edged up on many of these points in your questions above, but I think the following should now be answered:
The final question though has little to do with the shebang:
Resetting and explaining at a high level in sequence of execution:
Currently step 2 only happens if you use |
Sorry for the delay in responding, this is an incredibly detailed response, thank you so much for providing such an excellent guide. I've had a crack at applying the details above, and it seems to work, I'll post a summary of what I picked at some point for completeness in case others are interested. |
Hi,
I've looked at the docs and I'm still not clear about the difference between
--python
and--python-shebang
when invoking pex. I'm sure it's obvious to folks intimately familiar with python, but it would be great if the docs explained gave examples of why you might want to set these.For this example
So the python shebang as I understand it advises which interpreter should be used, specifically that value given should either be a full path to a binary interpreter e.g.
/usr/bin/python3
or a shorthand likepython3
if that's already on the path, is there a standard? because what if they don't have it on the path, and how do you know which version the user might have installed? and that interpreter will be used, in which case why do you need the --python environment values?python3
as opposed to/usr/local/bin/python3
The text was updated successfully, but these errors were encountered: