-
Notifications
You must be signed in to change notification settings - Fork 15.5k
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
python pkg_resources performance issues #7393
Comments
Can you send a PR? It's not exactly clear to me what we should change this to. We currently require Python 3.8 or higher. Can we just delete our |
Will see if I can dig back in on this and figure out what the current behavior is vs what removing some of the |
Sounds good. I'm unassigning myself since I'm not working on this myself. But I'd be happy to see a PR. |
We triage inactive PRs and issues in order to make it easier to find active work. If this issue should remain active or becomes active again, please add a comment. This issue is labeled |
We triage inactive PRs and issues in order to make it easier to find active work. If this issue should remain active or becomes active again, please reopen it. This issue was closed and archived because there has been no new activity in the 14 days since the |
I just ran into this legacy namespace problem myself on Ubuntu 22.04 when trying to use python3-protobuf I don't even understand why namespacing is used in the first place here? Isn't there just ONE package that is importable anyway? ( Why would namespacing be needed with just ONE single package? Does anybody know? |
What version of protobuf and what language are you using?
Version: master
Language: Python
What operating system (Linux, Windows, ...) and version?
Gentoo linux, but the problem is present on all platform.
What runtime / compiler are you using (e.g., python version or gcc version)
Version independent, but, pypy3, python3.6, python3.7.
What did you do?
Steps to reproduce the behavior:
python
import google.protobuf
or even justimport google
What did you expect to see
Not waiting 300ms for
google
orgoogle.protobuf
to improt.What did you see instead?
Waiting 300ms for import to finish because pkg_resources scans all installed packages.
Anything else we should know about your project / environment
This is a result of pypa/setuptools#510.
Suggested fix is to remove all top level imports of pkg_resources. For 3.7 and 3.8 it could be replaced with importlib.resources or importlib.metadata and apparently there are backports as well (see hgrecco/pint#1008 (comment)).
Here is the list of bad import statements.
protobuf/python/google/__init__.py
Line 2 in 97f5f64
protobuf/python/google/protobuf/__init__.py
Line 37 in 97f5f64
protobuf/python/google/protobuf/pyext/__init__.py
Line 2 in 97f5f64
The text was updated successfully, but these errors were encountered: