-
Notifications
You must be signed in to change notification settings - Fork 56
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
A little consistency in shebangs and execute bits #136
A little consistency in shebangs and execute bits #136
Conversation
Thanks :) Playing devil's advocate, are shebangs actually necessary at all? I always run my Python scripts by explicitly invoking the Python interpreter. Are these shebangs truly portable? And do others execute their scripts with shebangs directly? |
No.
No.
Yes, sometimes. However, it doesn’t take much time as even a casual Python user to learn I’m fully on board with the idea of removing all of the shebangs instead. |
These are not really necessary—users can always pass the script name to the Python interpreter explicitly; not really portable; and not useful anyway unless the execute permission bit is set on the files in question.
a5062a3
to
ce185f7
Compare
Excellent, thank you! I'm going to give this a couple of days to see if @moorepants chimes in with a different opinion before I merge. |
I would suggest leaving the correct shebangs in the example scripts. If they are made executable and cyipopt is installed, then they work as expected. I'm not sure why to remove them. They are helpful for those that need/want them. The space character in some are incorrect though (I think). |
The space is allowed but not useful. So if the shebangs stay, I suppose the following questions remain:
|
Those are all good with me. I don't know the consequences of using |
I just tested this on MacOS (assuming a user has installed CyIpopt to use system Python) and using |
For context, I’m working on a When building Python RPMs in Fedora, we rewrite all shebangs to Either approach is justifiable from my perspective—shebangs and executable bits, or neither—but the middle ground of shebangs without executable bits doesn’t make sense in my opinion. Different projects make different choices, usually for valid reasons, and I’ll follow whatever decision is reached here in the downstream package. |
(I just noticed that |
Thanks for this, @musicinmybrain. Due to the risk of the shebangs not working universally, can this PR please remove all shebangs across the package (taking @moorepants's thumbs up on my comment this morning as agreement)? |
The things in the examples/ directory are not packaged with cyipopt (PyPi or conda packages). If you are packaging the examples in the fedora package, then we should get them working for that. The shebangs aren't needed in anything that isn't intended to run as a script and can be removed. |
My thumbs up was intended for using python3 instead of python. But, I'm fine removing them all. It's really not something to spend too much thought or typing on :) |
These files have no script-like content at all, so the shebangs were unambiguously not useful.
I was planning to package them as part of a
Yes, I’ll add a commit. |
Adds a shebang to
examples/rosen.py
, to match the other examples.Sets execute permission on all files with shebangs—the examples, plus
setup.py
—without which the shebangs have little value.