From 97a87ad568534a69a2b6f93071e23780402454c5 Mon Sep 17 00:00:00 2001 From: Gil Forcada Codinachs Date: Fri, 15 Sep 2023 18:10:48 +0200 Subject: [PATCH] Use importlib.metadata To get the version of package dynamically --- flake8_isort.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/flake8_isort.py b/flake8_isort.py index cc2299b..0bbc714 100644 --- a/flake8_isort.py +++ b/flake8_isort.py @@ -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