Skip to content
This repository was archived by the owner on Mar 12, 2025. It is now read-only.

Remove dependency on pkg_resources #140

Closed
bivald opened this issue Oct 3, 2022 · 4 comments · Fixed by #187
Closed

Remove dependency on pkg_resources #140

bivald opened this issue Oct 3, 2022 · 4 comments · Fixed by #187
Assignees
Labels
priority: p2 Moderately-important priority. Fix may not be included in next release. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns.

Comments

@bivald
Copy link

bivald commented Oct 3, 2022

Is your feature request related to a problem? Please describe.
Trying to reduce boot time for my Cloud Run API I'm profiling imports, and google.rpc add significant time to the applications imports due to the use of pkg_resources

Describe the solution you'd like
Similar to googleapis/python-api-core#361 - it would be awesome if we could remove the use or pkg_resources (not idea of the effort though)

@parthea parthea added type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns. priority: p2 Moderately-important priority. Fix may not be included in next release. labels Oct 3, 2022
@jenshnielsen
Copy link

In addition to the above setuptools has now deprecated the use of pkg_resources.declare_namespace
which is still used in this package here https://github.com/googleapis/python-api-common-protos/blob/main/google/rpc/__init__.py and possibly elsewhere.

See the setuptools changelog

@JordiSalaJuarez
Copy link

Let me know if this is a good idea, I feel like we can do better than filtering warnings but I don't know if there will be side effects on other projects if we use implicit namespaces, this fix uses PEP 420 which is the desired way by setuptools

@meredithslota
Copy link

Dependent libraries still use https://github.com/googleapis/python-datastore/blob/main/google/__init__.py files — do these need to be removed manually?

@parthea
Copy link
Contributor

parthea commented Nov 8, 2023

Yes, it is necessary to remove __init__.py once we migrate to native namespace packages as per https://packaging.python.org/en/latest/guides/packaging-namespace-packages/#native-namespace-packages. This work was already completed in google-auth via googleapis/google-auth-library-python#1205. We will need to make a similar PR in each python repository in the googleapis organization.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
priority: p2 Moderately-important priority. Fix may not be included in next release. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants