grpc / grpc/grpc

pkg_resources deprecated in grpc_tools/protoc.py

Open
#33,570 9 comments 21 reactions 1 assignee Assigned to @XuanWang-Amos View on GitHub
kind/enhancement lang/Python priority/P2
Dominant language
C++
Stars
45.3k
Forks
11.4k
Avg merge
2d 12h
Merged PRs (30d)
47

Description

### Is your feature request related to a problem? Please describe.
When using grpc_tools/protoc.py with recent versions of setuptools (v67+) we get a deprecation warning:

```
site-packages/grpc_tools/protoc.py:21: DeprecationWarning: pkg_resources is deprecated as an API. See https://setuptools.pypa.io/en/latest/pkg_resources.html
import pkg_resources
```

### Describe the solution you'd like
The solution is to conditionally use `importlib-resources` for python >= 3.7, if 3.6 and older are still to be supported. There is a migration guide here: https://importlib-resources.readthedocs.io/en/latest/migration.html

### Describe alternatives you've considered
An other option would be to silence the deprecation warning for now but I do not recommend that approach.

### Additional context
This is on macOS 13.4.1, Python 3.11.4 and grpcio-tools==1.56.0.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.