[Python-Dev] Bilingual scripts
chrism at plope.com
Sat May 25 09:12:32 CEST 2013
On Fri, 2013-05-24 at 15:56 -0400, Barry Warsaw wrote:
> Here's something that seems to come up from time to time in Debian.
> Take a Python application like tox, nose, or pyflakes. Their executables work
> with both Python 2 and 3, but require a #! line to choose which interpreter to
You probably already know this, but I'll mention it anyway. This
probably matters a lot for nose and pyflakes, but I'd say that for tox
it should not, it basically just scripts execution of shell commands.
I'd think maybe in cases like tox (and others that are compatible with
both Python 2 and 3) the hashbang should just be set to
Maybe we could also think about modifying pyflakes so that it can
validate both 2 and 3 code (choosing one or the other based on a header
line in the validated files and defaulting to the version of Python
being run). This is kind of the right thing anyway.
Nose is a bit of a special case. I personally never run nosetests
directly, I always use setup.py nosetests, which makes it not matter.
In general, I'd like to think that scripts that get installed to global
bindirs will execute utilities that are useful independent of the
version of Python being used to execute them.
More information about the Python-Dev