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

high-level: Explicitly use python3 #254

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

Conversation

wcohen
Copy link
Contributor

@wcohen wcohen commented Oct 4, 2024

Python3 has been released for over 15 years. Fedora, Debian, and other distributions state that python scripts should avoid using unversioned python intepreter:

https://fedoraproject.org/wiki/FinalizingFedoraSwitchtoPython3 https://www.debian.org/doc/packaging-manuals/python-policy/

The RPM build process will flag unversioned python interpreter use as an error and the build will fail. Making the papi_hl_output_writer.py explicitly use /usr/bin/python3.

Pull Request Description

Author Checklist

  • Description
    Why this PR exists. Reference all relevant information, including background, issues, test failures, etc
  • Commits
    Commits are self contained and only do one thing
    Commits have a header of the form: module: short description
    Commits have a body (whenever relevant) containing a detailed description of the addressed problem and its solution
  • Tests
    The PR needs to pass all the tests

Python3 has been released for over 15 years.  Fedora, Debian, and
other distributions state that python scripts should avoid using
unversioned python intepreter:

https://fedoraproject.org/wiki/FinalizingFedoraSwitchtoPython3
https://www.debian.org/doc/packaging-manuals/python-policy/

The RPM build process will flag unversioned python interpreter use as
an error and the build will fail.  Making the papi_hl_output_writer.py
explicitly use /usr/bin/python3.
@Treece-Burgess
Copy link
Contributor

@wcohen I think updating the shebang does make sense. What is your reasoning behind using #!/usr/bin/python3 instead of #!/usr/bin/env python3?

#!/usr/bin/env python3 has the pros of looking through the PATH for the Python directory, which makes the script overall more portable. Virtual environments have became increasingly more popular with even Oak Ridge pushing users to create a virtual environment if they have specific Python packages they want to use. With #!/usr/bin/python3 it assumes the Python interpreter is located there on each machine.

@wcohen
Copy link
Contributor Author

wcohen commented Oct 4, 2024

I am open to #!/usr/bin/env python3. The original patch was a minimal change to ensure that things build on Fedora without patching. Fedora (https://fedoraproject.org/wiki/FinalizingFedoraSwitchtoPython3) mentions #!/usr/bin/env name and is okay with it. However, Debian (https://www.debian.org/doc/packaging-manuals/python-policy/) cautions against it in section 3.5.2:

Maintainers should not override the Debian Python interpreter using /usr/bin/env name. This is not advisable as it bypasses Debian’s dependency checking and makes the package vulnerable to incomplete local installations of Python.

@wcohen
Copy link
Contributor Author

wcohen commented Oct 4, 2024

I have a branch with the #!/usr/bin/env python3. I could update the pull request with that patch if it is preferred.

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.

2 participants