Coverage for lintro / utils / environment / python_info.py: 81%
16 statements
« prev ^ index » next coverage.py v7.13.0, created at 2026-04-03 18:53 +0000
« prev ^ index » next coverage.py v7.13.0, created at 2026-04-03 18:53 +0000
1"""Python runtime information."""
3from __future__ import annotations
5from dataclasses import dataclass
8@dataclass
9class PythonInfo:
10 """Python runtime information."""
12 version: str
13 executable: str
14 virtual_env: str | None
15 pip_version: str | None
16 uv_version: str | None
18 @property
19 def section_title(self) -> str:
20 """Return the section title for display."""
21 return "Python"
23 def to_display_rows(self) -> list[tuple[str, str]]:
24 """Return label-value pairs for rendering."""
25 return [
26 ("Version", self.version),
27 ("Executable", self.executable),
28 ("Virtual Env", self.virtual_env or "(none)"),
29 ("pip", self.pip_version or "(not found)"),
30 ("uv", self.uv_version or "(not found)"),
31 ]
33 def is_available(self) -> bool:
34 """Return whether this section has data to display."""
35 return True