-
Notifications
You must be signed in to change notification settings - Fork 670
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
Reference to pkg_resources #684
Labels
Comments
This might be a Jazzband-wide problem. CC @jezdez seeing if anyone else has a different method of doing the same. But lgtm! Feel free to open a PR |
Caellion
added a commit
to Caellion/djangorestframework-simplejwt
that referenced
this issue
Apr 25, 2023
Co-Authored-By: nielsuit227
Caellion
added a commit
to Caellion/djangorestframework-simplejwt
that referenced
this issue
Apr 25, 2023
Co-Authored-By: nielsuit227
Closed
what do you think about something like this ugly example: import sys
if sys.version_info >= (3, 8):
from importlib import metadata
try:
__version__ = metadata.version("djangorestframework_simplejwt")
except metadata.PackageNotFoundError:
# package is not installed
__version__ = None
else:
from pkg_resources import DistributionNotFound, get_distribution
try:
__version__ = get_distribution("djangorestframework_simplejwt").version
except DistributionNotFound:
# package is not installed
__version__ = None |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Setuptools has deprecated
pkg_resources
, and recommends toimportlib
instead.This results in a deprecation warnings for
setuptools >= 67.3.0
.https://setuptools.pypa.io/en/latest/pkg_resources.html
Also the python packaging docs say the same, and recommend the following snippet.
Note that this does include an additional depenceny for Python 3.7,
importlib-metadata
. With that, all seems to work fine for your supported python versions (3.7-3.10)The text was updated successfully, but these errors were encountered: