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 21a02ce
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions flake8_isort.py
Expand Up @@ -5,13 +5,13 @@
from pathlib import Path

import isort
from pkg_resources import DistributionNotFound, get_distribution
from importlib.metadata import version, PackageNotFoundError


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 21a02ce

Please sign in to comment.