Python updated setuptools and wheel

Change effective on 12 April 2023

The packaging tools used during the build of Python apps have been updated as follows:

  • setuptools updated from 63.4.3 to 67.6.1 (changelog)
  • wheel updated from 0.38.4 to 0.40.0 (changelog)

Of note, setuptools v66+ now rejects package versions that do not adhere to PEP 440 and PEP 508. If the build of your application now fails due to this, check whether there are newer versions of the affected package available that includes a fix, and if not, report the issue to the maintainers of that package.

In addition, setuptools v64+ has improved the way package imports and isolation works for projects installed in editable mode (when -e or --editable is used in the requirements file). However, in rare cases these improvements can cause previously working project layouts to fail with import errors. If your application uses editable mode and now encounters import errors, check setuptools’ list of editable mode limitations and either adjust the application’s directory layout or switch away from using editable mode.

If you need to temporarily switch back to the previous setuptools and wheel versions until issues can be fixed, then pin your application’s Python buildpack version to the previous release. To do this, use a buildpack URL of https://github.com/heroku/heroku-buildpack-python.git#v230 . Make sure to return to the recommended heroku/python buildpack URL/alias once your app is compatible with the new setuptools version. For more information, see setting a buildpack on an application, or if your app uses multiple buildpacks, see the steps here.