This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author joshtriplett
Recipients joshtriplett
Date 2022-02-05.02:02:13
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1644026533.87.0.375364061362.issue46645@roundup.psfhosted.org>
In-reply-to
Content
I'm writing this issue on behalf of the Rust project.

The build system for the Rust compiler is a Python 3 script `x.py`, which orchestrates the build process for a user even if they don't already have Rust installed. (For instance, `x.py build`, `x.py test`, and various command-line arguments for more complex cases.)

We currently run into various issues making this script easy for people to use on all common platforms people build Rust on: Windows, macOS, and Linux.

If we use a shebang of `#!/usr/bin/env python3`, then x.py works for macOS and Linux users, and also works on Windows systems that install Python via the Windows store, but fails to run on Windows systems that install via the official Python installer, requiring users to explicitly invoke Python 3 on the script, and adding friction, support issues, and complexity to our documentation to help users debug that situation.

If we use a shebang of `#!/usr/bin/env python`, then x.py works for Windows users, fails on some modern macOS systems, works on other modern macOS systems (depending on installation method I think, e.g. homebrew vs Apple), fails on some modern Linux systems, and on macOS and Linux systems where it *does* work, it might be python2 or python3. So in practice, people often have to explicitly run `python3 x.py`, which again results in friction, support issues, and complexity in our documentation.

We've even considered things like `#!/bin/sh` and then writing a shell script hidden inside a Python triple-quoted string, but that doesn't work well on Windows where we can't count on the presence of a shell.

We'd love to write a single shebang that works for all of Windows, macOS, and Linux systems, and doesn't resort in recurring friction or support issues for us across the wide range of systems that our users use.

As far as we can tell, `#!/usr/bin/env python3` would work on all platforms, if the Python installer for Windows shipped a `python3.exe` and handled that shebang by using `python3.exe` as the interpreter.

Is that something that the official Python installer could consider adding, to make it easy for us to supply cross-platform Python 3 scripts that work out of the box for all our users?

Thank you,
Josh Triplett, on behalf of many Rust team members
History
Date User Action Args
2022-02-05 02:02:13joshtriplettsetrecipients: + joshtriplett
2022-02-05 02:02:13joshtriplettsetmessageid: <1644026533.87.0.375364061362.issue46645@roundup.psfhosted.org>
2022-02-05 02:02:13joshtriplettlinkissue46645 messages
2022-02-05 02:02:13joshtriplettcreate