Skip to content

Update to Python 3.12.0#209

Merged
edmorley merged 1 commit intomainfrom
edmorley/python-3.12
Oct 4, 2023
Merged

Update to Python 3.12.0#209
edmorley merged 1 commit intomainfrom
edmorley/python-3.12

Conversation

@edmorley
Copy link
Copy Markdown
Member

@edmorley edmorley commented Oct 3, 2023

@edmorley edmorley self-assigned this Oct 3, 2023
@heroku heroku bot temporarily deployed to getting-star-edmorley-p-biivve October 3, 2023 19:59 Inactive
edmorley added a commit to heroku/heroku-buildpack-python that referenced this pull request Oct 3, 2023
In the newly released Python 3.12, the `pkgutil.find_loader()` API
was deprecated:
https://docs.python.org/3.12/library/pkgutil.html#pkgutil.find_loader

It's been replaced by `importlib.util.find_spec` which is supported
since Python 3.4 (which is fine for us to use now, but wasn't an option
back when `is_module_available()` was written, since at that time the
buildpack still had to support Python 2.7):
https://docs.python.org/3.12/library/importlib.html#importlib.util.find_spec

This API was used by the buildpack to determine whether certain
packages (like `django` or `nltk`) are installed, and so resulted in
deprecation warnings being output in the build log:

```
<string>:1: DeprecationWarning: 'pkgutil.find_loader' is deprecated and slated for removal in Python 3.14; use importlib.util.find_spec() instead
```

These deprecation warnings also prevented the output from `bin/release`
being parsed correctly for Django apps, resulting in:

```
failed to read buildpack metadata: (<unknown>): mapping values are not allowed in this context at line 1 column 31
```

These can be seen in the Heroku CI tests and Review App build logs
of this PR which upgrades the Python getting started guide app to
Python 3.12:
heroku/python-getting-started#209
https://dashboard.heroku.com/pipelines/4826c212-2bb2-4882-a147-4d0501eee7a4/tests/190
https://dashboard.heroku.com/apps/getting-star-edmorley-p-biivve/activity/builds/a6feca96-d451-4f01-b66d-c5d2185d5107

GUS-W-14230170.
@edmorley edmorley force-pushed the edmorley/python-3.12 branch from 3da0e7f to a6f138b Compare October 3, 2023 21:00
@heroku heroku bot temporarily deployed to getting-star-edmorley-p-ivnqg5 October 3, 2023 21:00 Inactive
@edmorley edmorley marked this pull request as ready for review October 3, 2023 21:15
@edmorley edmorley merged commit 803078e into main Oct 4, 2023
@edmorley edmorley deleted the edmorley/python-3.12 branch October 4, 2023 07:21
@edmorley
Copy link
Copy Markdown
Member Author

edmorley commented Oct 4, 2023

Getting started guide build output and Python version requirement updated:
https://devcenter.heroku.com/articles/getting-started-with-python

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant