Skip to content

Commit

Permalink
Use importlib.metadata
Browse files Browse the repository at this point in the history
To get the version of package dynamically
  • Loading branch information
gforcada committed Sep 15, 2023
1 parent 62e5510 commit d83c071
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions flake8_isort.py
@@ -1,17 +1,17 @@
import warnings
from contextlib import redirect_stdout
from difflib import unified_diff
from importlib.metadata import PackageNotFoundError, version
from io import StringIO
from pathlib import Path

import isort
from pkg_resources import DistributionNotFound, get_distribution


def _version():
try:
return get_distribution('flake8_isort').version
except DistributionNotFound:
return version('flake8_isort')
except PackageNotFoundError:
return 'dev' # for local development if package is not installed yet


Expand Down

0 comments on commit d83c071

Please sign in to comment.