Skip to content
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

Enhancement proposal: replace use of pkg_resources in _version.py performance reasons #461

Closed
pi-slh opened this issue Feb 22, 2023 · 1 comment

Comments

@pi-slh
Copy link
Contributor

pi-slh commented Feb 22, 2023

pkg_resources can contribute to slow application startup times. Some evaluations of this issue are linked here; pypa/setuptools#926

The functionality used in betterproto of looking up betterproto's own installed version can be replaced by https://docs.python.org/3/library/importlib.metadata.html and the https://github.com/python/importlib_metadata backport.

The enhancement being proposed is to remove the pkg_resources import by replacing pkg_resources.get_distribution("betterproto").version with the equivalent importlib lookup.

@MicaelJarniac
Copy link
Contributor

There's now a deprecation warning about pkg_resources:

venv/lib/python3.9/site-packages/betterproto/__init__.py:39: in <module>
    from ._version import __version__
venv/lib/python3.9/site-packages/betterproto/_version.py:1: in <module>
    from pkg_resources import get_distribution
venv/lib/python3.9/site-packages/pkg_resources/__init__.py:121: in <module>
    warnings.warn("pkg_resources is deprecated as an API", DeprecationWarning)
E   DeprecationWarning: pkg_resources is deprecated as an API

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants