|
|
|
|
|
by bestcoder69
1402 days ago
|
|
Tangentially related, I came up with something atrocious last night. If you install pex with pipx (or put pex in $PATH another way), you can declare your python script dependencies in the shebang line, like: #!/usr/bin/env pex requests==2.28.1 other_dep=1.2.3 --exe
import requests
def main():
...
Then, you can `chmod +x` your script and call it with "--" between the script name and your arguments, if any: ./main.py -- arg1 arg2
Requests will be installed the first time you run it, then pex should use its cache for subsequent invocations.I wonder if anyone's done this in earnest? |
|