Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace deprecated importlib.resources.read_binary with (files() / …).read_bytes() (Cherry-pick of #22162) #22165

Merged
merged 1 commit into from
Apr 2, 2025

Conversation

WorkerPants
Copy link
Member

A user packaging a FaaS artifact with Pants 2.25 can see a warning, that this PR resolves:

10:05:59.12 [WARN] .../venvs/2.25.1rc0/lib/python3.11/site-packages/pants/backend/python/util_rules/faas.py:476: DeprecationWarning: read_binary is deprecated. Use files() instead. Refer to https://importlib-resources.readthedocs.io/en/latest/using.html#migrating-from-legacy for migration advice.
  content = importlib.resources.read_binary(module, file_name)

I think this warning started in Pants 2.25 due to the Python 3.11 upgrade.

….read_bytes() (#22162)

A user packaging a FaaS artifact with Pants 2.25 can see a warning, that
this PR resolves:

```
10:05:59.12 [WARN] .../venvs/2.25.1rc0/lib/python3.11/site-packages/pants/backend/python/util_rules/faas.py:476: DeprecationWarning: read_binary is deprecated. Use files() instead. Refer to https://importlib-resources.readthedocs.io/en/latest/using.html#migrating-from-legacy for migration advice.
  content = importlib.resources.read_binary(module, file_name)
```

I think this warning started in Pants 2.25 due to the Python 3.11
upgrade.
@huonw huonw enabled auto-merge (squash) April 2, 2025 00:33
@huonw huonw merged commit 98e4c23 into 2.25.x Apr 2, 2025
24 checks passed
@huonw huonw deleted the cherry-pick-22162-to-2.25.x branch April 2, 2025 00:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
release-notes:not-required PR doesn't require mention in release notes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants