PennLINC / babs

BIDS App Bootstrap (BABS)
https://pennlinc-babs.readthedocs.io
MIT License
5 stars 5 forks source link

Don't hardcode python interpreter in scripts #155

Closed asmacdo closed 11 months ago

asmacdo commented 11 months ago

Summary

I ran babs-init on my local machine, which created my /bin scripts with the shebang #!/home/austin/.conda/envs/babs/bin/python

I have modified it by hand to:

(babs) [root@slurmctl bin]# cat babs-check-setup 

#!/usr/bin/env python
# -*- coding: utf-8 -*-
import re
import sys
from babs.cli import babs_check_setup_main
if __name__ == '__main__':
    sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
    sys.exit(babs_check_setup_main())

Given that users are expected to activate the conda env prior to execution, I think we are safe to change this to #!/usr/bin/env python which appears to be working for me.

As it is, the user must do all of the setup work in the same environment it will be executed on, but I am hoping we can enable users to do the initial work outside of the HPC env.

yarikoptic commented 11 months ago

I think that is ok/expected behavior of establishing entry point scripts within venv -- they would point explicitly to the venv's python to ensure that they could be used without any source .../bin/activate, so I do not think there is anything to fix really. Please reopen if disagree