Currently the buildpack performs a system site-packages install of not only pip, but also setuptools and wheel. This has historically been necessary for pip to be able to build source distributions (sdists) for packages that don't ship with compatible wheels.
However:
Thanks to PEP 517 / PEP 518, packages can now (and many already do) specify an explicit build backend using [build-system] in their pyproject.toml. The dependencies specified in that config (such as setuptools and wheel) will be installed by pip into an isolated and ephemeral build environment as part of the source distribution build process. Such packages therefore don't need/use globally installed setuptools/wheel versions.
As of pip v22.1, pip will now default to the isolated build environment mode (along with a fallback legacy setuptools build backend), if the setuptools package isn't installed globally. This means that packages that haven't yet migrated to a PEP 517/518 pyproject.toml build backend config can still build even if setuptools isn't installed globally. (There are a small number of rarely used packages in the wild that aren't compatible with build isolation mode, however, these typically require more build dependencies than just setuptools, which means they wouldn't have worked with this buildpack anyway.)
As such, it's no longer necessary for us to install setuptools and wheel globally - and removing their install means we'll match the behaviour of the venv and ensurepip modules in Python 3.12+, where setuptools and wheel installation has also been removed.
In addition, these packages will no longer be accessible by app dependencies after the upcoming switch to venvs (see #253), so there is no point continuing to install them in the user site-packages directory.
This change also improves parity with the default behaviour of Poetry too, whose install --sync command removes any implicitly installed packages in the current environment (other than pip).
Currently the buildpack performs a system site-packages install of not only pip, but also setuptools and wheel. This has historically been necessary for pip to be able to build source distributions (sdists) for packages that don't ship with compatible wheels.
However:
[build-system]
in theirpyproject.toml
. The dependencies specified in that config (such as setuptools and wheel) will be installed by pip into an isolated and ephemeral build environment as part of the source distribution build process. Such packages therefore don't need/use globally installed setuptools/wheel versions.pyproject.toml
build backend config can still build even if setuptools isn't installed globally. (There are a small number of rarely used packages in the wild that aren't compatible with build isolation mode, however, these typically require more build dependencies than just setuptools, which means they wouldn't have worked with this buildpack anyway.)As such, it's no longer necessary for us to install setuptools and wheel globally - and removing their install means we'll match the behaviour of the
venv
andensurepip
modules in Python 3.12+, where setuptools and wheel installation has also been removed.In addition, these packages will no longer be accessible by app dependencies after the upcoming switch to venvs (see #253), so there is no point continuing to install them in the user site-packages directory.
This change also improves parity with the default behaviour of Poetry too, whose
install --sync
command removes any implicitly installed packages in the current environment (other than pip).See:
GUS-W-16437776.