[TriLUG] arguments to remove a thin python wrapper
Kevin Hunter Kesling
hunteke at earlham.edu
Fri Jan 10 10:36:16 EST 2014
Hello TriLUG,
Given our recent Python go-round, I thought I'd borrow your collective
knowledge for a minute.
I'm using a project (call it ProjX) that installs itself into a virtual
environment. So that users can put the ProjX bin/ directory into their
path without co-opting the system's python binary[1], ProjX has created
ProjX_python. That is, I currently run:
$ ProjX_python my_script.py
Unlike what I might have expected, that ProjX_python is a symbolic link,
ProjX_python is a script that begins:
#!/path/to/their/virtual/instance/bin/python
On inspection, all ProjX_python merely emulates the python binary by
opening calling code.InteractiveConsole() if there are no arguments, or
calling the ProjX python binary through subprocess otherwise. In other
words, my command line creates output like this in ps:
1. \_ /bin/bash
2. | \_ .../ProjX/bin/python .../ProjX/bin/ProjX_python my_script.py
3. | \_ .../ProjX/bin/python my_script.py
As my_script.py gets "more advanced" I'd like to start handling things
like Ctrl+C for my users. Right now, ProjX_python appears to take this
from me. I'm also annoyed by the 13.5 MiB wasted by that process, but
that's no longer a "big deal" in the scheme of things.
Obviously this is a cosmetic thing in that I can just type the full path
each time, or tell my users to create a symlink in their $HOME/bin/
directory, but the design of ProjX_python is one that I have disliked
for quite awhile. Unfortunately, this is the first example I've run
across where it has actually affected me and given me impetus to "see
what can be done." I'd like to make a well-reasoned argument for
changing ProjX_python to be a symbolic link. Given that this wrapper
script does literally nothing but open a subprocess, are there other,
perhaps higher-profile issues that I'm overlooking?
Thanks for your thoughts,
Kevin
[1] i.e., the difference between
export PATH="$PATH:/path/to/ProjX/bin" # good
and
export PATH="/path/to/ProjX/bin:$PATH" # bad
More information about the TriLUG
mailing list