-
Notifications
You must be signed in to change notification settings - Fork 663
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
Fix #684 #702
Fix #684 #702
Conversation
Co-Authored-By: nielsuit227
for more information, see https://pre-commit.ci
If possible, to avoid the dependency, can you use the old code when Python < 3.8 in your if else statement? Thank you |
as per @Andrew-Chen-Wang's request
for more information, see https://pre-commit.ci
On python 3.7.11 it breaks with I think I will have to keep dependency on importlib-metadata on python 3.7 |
else it breaks with `NameError: name 'DistributionNotFound' is not defined` on 3.7.11
for more information, see https://pre-commit.ci
why not hardcode the version in |
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 |
Fixes #684
Attempts to fix using @nielsuit227's code
Note: This creates a dependency on
importlib-metadata
for Python 3.7Also note: I am not sure how to update setup to conditionally depend on
importlib-metadata
, please advise