TL;DR: On 2024-12-17, we’ll be taking stewardship of python-build-standalone, Gregory Szorc’s foundational project for building and installing portable Python distributions. You can read Gregory’s own announcement here. (View Highlight)
We use python-build-standalone in uv, but it’s also part of a broader ecosystem and will continue to be developed with that broader ecosystem in mind. We’re excited to devote full-time resources to its maintenance and development, and to foster the level of engagement and activity that you might be familiar with from Ruff or uv. (View Highlight)
Normally, when you build CPython on Linux or macOS, several system paths are hardcoded into the binary. This is fine if you’re building and installing Python on a single machine, but it’s a problem if you want to pre-build Python and then distribute it to other machines. CPython is also dynamically linked against a number of system libraries, which can cause trouble if the target machine doesn’t have those libraries installed. In this way, CPython is not “standalone”: it’s tightly coupled to the system on which it was built. (View Highlight)
As a result, when you download Python from python.org (on Linux or macOS), what you’re actually downloading is an installer that builds Python from source on your machine. Similarly, when you install Python with pyenv, it too is building from source. (View Highlight)
While source installations have their benefits, they have some drawbacks too:
Building from source is much slower than downloading a pre-built binary. This is especially true if you’re building CPython with optimizations enabled (i.e., PGO and LTO). Notably, pyenv does not build with optimizations enabled by default, so if you’re using pyenv to install Python, you’re leaving significant performance improvements on the table.
Building from source introduces a dependency on a build toolchain (e.g., gcc). And it can fail! For a variety of reasons: missing dependencies, incompatible system libraries, etc. (View Highlight)
The net effect, though, is that you can’t “download a Python binary” from… anywhere. Other than the python-build-standalone project. (View Highlight)
Specifically, python-build-standalone solves these problems by (1) statically linking Python against its dependencies; and (2) patching the CPython build system to operate on relative, rather than absolute paths. (View Highlight)
With those modifications, it then builds Python from source across a wide matrix of Python versions, platforms, and build variants (e.g., optimized vs. debug builds), and publishes the built distributions to GitHub Releases. (View Highlight)
The Python builds produced by python-build-standalone are truly standalone: you can download, unzip, and run them on any machine, without any additional dependencies. They make uv python install feel magical. Not only is it extremely fast, but (to borrow from Armin), it’s hassle-free. (View Highlight)