Skip to content

Commit

Permalink
Replace pkg_resources with importlib.metadata
Browse files Browse the repository at this point in the history
  • Loading branch information
Nour-Mws committed Feb 10, 2023
1 parent 5dad899 commit 7113a2f
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions fawltydeps/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@
from pathlib import Path
from typing import List, Optional, Set, TextIO

import pkg_resources

from fawltydeps import extract_imports
from fawltydeps.check import compare_imports_to_dependencies
from fawltydeps.extract_declared_dependencies import extract_declared_dependencies
Expand All @@ -23,6 +21,11 @@
UnusedDependency,
)

if sys.version_info >= (3, 8):
import importlib.metadata as importlib_metadata
else:
import importlib_metadata

logger = logging.getLogger(__name__)


Expand Down Expand Up @@ -138,7 +141,7 @@ def main() -> int:
"-V",
"--version",
action="version",
version=f"Fawltydeps {pkg_resources.get_distribution('fawltydeps').version}",
version=f"Fawltydeps {importlib_metadata.version('fawltydeps')}",
help=("Print the version number of fawltydeps"),
)
select_action.add_argument(
Expand Down

0 comments on commit 7113a2f

Please sign in to comment.