[Python-ideas] py launcher for Linux?
Éric Araujo
merwok at netwok.org
Fri Apr 18 21:49:43 CEST 2014
Hi,
Le 15/04/2014 22:12, Nick Coghlan a écrit :
> Something that came up during PyCon was the idea of a "py" script that
> brought "Python Launcher for Windows" explicit version dispatch to Linux.
As a Debian end user and Python developer, I don’t have a need for
this; Unixen have shebangs and naming conventions (more or less similar
across OSes) for co-installed versions of Python. (“Explicit dispatch”
and “cross-platform invocation” don’t tell me much.) I went back and
read the beginning of PEP 397 again to find use cases:
Abstract
This PEP describes a Python launcher for the Windows platform.
A Python launcher is a single executable which uses a number of
heuristics to locate a Python executable and launch it with a
specified command line.
Rationale
Windows provides "file associations" so an executable can be
associated with an extension, allowing for scripts to be executed
directly in some contexts (eg., double-clicking the file in Windows
Explorer.) Until now, a strategy of "last installed Python wins"
has been used and while not ideal, has generally been workable due
to the conservative changes in Python 2.x releases. As Python 3.x
scripts are often syntactically incompatible with Python 2.x
scripts, a different strategy must be used to allow files with a
'.py' extension to use a different executable based on the Python
version the script targets. This will be done by borrowing the
existing practices of another operating system - scripts will be
able to nominate the version of Python they need by way of a
"shebang" line, as described below.
It seems to me the problem is defined as specific to Windows, and the
solution takes inspiration from other operating systems. I think a new
rationale explaining why bring back that solution to these other OSes is
needed.
Regards
More information about the Python-ideas
mailing list