From c8ece56ce18f81e7767148db7aa2fa8900e8a892 Mon Sep 17 00:00:00 2001 From: David Hotham Date: Thu, 21 Mar 2024 23:17:33 +0000 Subject: [PATCH] simplify importlib.metadata.version treatment --- src/poetry/console/commands/about.py | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) diff --git a/src/poetry/console/commands/about.py b/src/poetry/console/commands/about.py index cf2548d6f59..56d8e7acdf0 100644 --- a/src/poetry/console/commands/about.py +++ b/src/poetry/console/commands/about.py @@ -1,14 +1,8 @@ from __future__ import annotations -from typing import TYPE_CHECKING - from poetry.console.commands.command import Command -if TYPE_CHECKING: - from collections.abc import Callable - - class AboutCommand(Command): name = "about" @@ -17,16 +11,12 @@ class AboutCommand(Command): def handle(self) -> int: from poetry.utils._compat import metadata - # The metadata.version that we import for Python 3.7 is untyped, work around - # that. - version: Callable[[str], str] = metadata.version - self.line( f"""\ Poetry - Package Management for Python -Version: {version('poetry')} -Poetry-Core Version: {version('poetry-core')} +Version: {metadata.version('poetry')} +Poetry-Core Version: {metadata.version('poetry-core')} Poetry is a dependency manager tracking local dependencies of your projects\ and libraries.