Skip to content

[Feature] [Python]User importlib.metadata to replace pkg_resources #11509

@shenxiangzhuang

Description

@shenxiangzhuang

Search before asking

  • I had searched in the issues and found no similar feature requirement.

Description

We are using pkg_resources in our project:

https://github.com/apache/skywalking-python/blob/f8c5063402dcea354458a23f1f74561b6bea98b6/skywalking/plugins/__init__.py#L23C1-L23C1

https://github.com/apache/skywalking-python/blob/f8c5063402dcea354458a23f1f74561b6bea98b6/tools/grpc_code_gen.py#L21

And the usage of pkg_resources is deprecated with warning(which can be reproduced by run import pkg_resources in REPL) as fellows:

DeprecationWarning: pkg_resources is deprecated as an API. See https://setuptools.pypa.io/en/latest/pkg_resources.html

As the doc https://setuptools.pypa.io/en/latest/pkg_resources.html shows:

Use of pkg_resources is deprecated in favor of importlib.resources, importlib.metadata and their backports (importlib_resources, importlib_metadata)

So, I think it's better to do this replacement.

Use case

Replace the usage of pkg_resources to importlib.metadata to remove the warning message

Related issues

No response

Are you willing to submit a pull request to implement this on your own?

  • Yes I am willing to submit a pull request on my own!

Code of Conduct

Metadata

Metadata

Labels

dependenciesPull requests that update a dependency filefeatureNew featurepythonPython agent related

Type

No type
No fields configured for issues without a type.

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions