Open rydrman opened 3 years ago
Something along this lines?
#!/usr/bin/bash
""":"
echo "Im in bash"
spk env python/3 -- python $0
":"""
From the meeting today: we like the idea, can we provide consistent behavior that is predictable?
spk-interpreter
as a separate binaryLet's go with option number 2 (re-parse if a space is in there)
Just to clarify @alexxbb's comment, since we talked about it today on the SPI internal chat:
He's not proposing that instead of Ryan's shebang idea. He's pointing out that as a workaround for this today, you can take a python script you have already and lightly edit it like this to make it run itself inside a particular spk environment (by disguising it as a bash script that launches the env, then runs the remainder of its contents as python):
#!/usr/bin/bash
""":"
spk env python/3.7 openimageio/=2.3.9.1 -- python $0
":"""
import OpenImageIO as oiio
... rest of python script, running python 3.7 and importing openimageio 2.3.9.1 from spk ...
It would be great if there was a subcommand or option which would allow spk to be referenced directly in a shebang line, for example:
Currently shebang only allows for one argument, so this gets called as
spk "env python/3 -- python" script.py
which would need to be recognized and re-parsed by the spk command line in order to function as expected