-
Notifications
You must be signed in to change notification settings - Fork 658
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 usage of pkg_resources (setuptools) with importlib(._)resources? #2927
Labels
Comments
Clarification: This is not the only place pkg_resources is used but just the first. The others should be replaceable in the same way.
|
ocelotl
added a commit
to ocelotl/opentelemetry-python
that referenced
this issue
Nov 23, 2022
ocelotl
added a commit
to ocelotl/opentelemetry-python
that referenced
this issue
Nov 23, 2022
ocelotl
added a commit
to ocelotl/opentelemetry-python
that referenced
this issue
Nov 30, 2022
ocelotl
added a commit
to ocelotl/opentelemetry-python
that referenced
this issue
Dec 1, 2022
ocelotl
added a commit
to ocelotl/opentelemetry-python
that referenced
this issue
Dec 5, 2022
ocelotl
added a commit
to ocelotl/opentelemetry-python
that referenced
this issue
Dec 6, 2022
ocelotl
added a commit
to ocelotl/opentelemetry-python
that referenced
this issue
Dec 14, 2022
ocelotl
added a commit
to ocelotl/opentelemetry-python
that referenced
this issue
Jan 18, 2023
ocelotl
added a commit
to ocelotl/opentelemetry-python
that referenced
this issue
Jan 20, 2023
ocelotl
added a commit
to ocelotl/opentelemetry-python
that referenced
this issue
Feb 1, 2023
ocelotl
added a commit
that referenced
this issue
Feb 1, 2023
* Remove usage of pkg_resources Fixes #2927 * WIP * WIP * Add test case for _load_providers * Fix test case for 3.9 * Fix lint * Fix 3.7 sdk tests * Fix lint * Fix lint * Fix mypy again * WIP * WIP * WIP * WIP * Move to module * Fix SDK * Fix mypy * Refactor load call * Fix mypy * Fix lint * Fix opencensus exporter * Refactor implementation * Add missing dependency * Undo changes in shim * Fix dependency * Revert "Undo changes in shim" This reverts commit bd82b8f. * Update dependencies * Update dependency for opencensus exporter * Add descriptive error
6 tasks
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Is your feature request related to a problem?
Importing opentelemetry is rather slow due to the import of pkg_resources in opentelemetry.context here
It is a known shortcoming of
pkg_resources
that at import time it will pass all installed packages which is potentially slow.In my use case it adds ~0.7 s to the import time.
For this reason setuptools actively discourages the use of
pkg_resources
See hereDescribe the solution you'd like
Replace the use of pkg_resources with importlib.metadata / importlib.resources which is part of the python standard library in newer versions of python and use their backports in
importlib_metadata
/importlib_resources
as needed for older python versions.In this particular use case
pkg_resources
is used to find entry points and that should be replaceable by doingDescribe alternatives you've considered
Additional context
This will also mean that opentelemetry can potentially drop the need for a runtime dependency on setuptools and when older python versions (<3.9) are dropped only use the std library for entry point selection.
The text was updated successfully, but these errors were encountered: