heroku / buildpacks-python

Heroku's Cloud Native Buildpack for Python applications.
BSD 3-Clause "New" or "Revised" License
27 stars 3 forks source link

Stop installing setuptools and wheel #243

Closed edmorley closed 2 months ago

edmorley commented 2 months ago

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:

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).

See:

GUS-W-16437776.