Coverage for lintro / utils / environment / _protocol.py: 100%
8 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"""Protocol for renderable environment sections."""
3from __future__ import annotations
5from typing import Protocol, runtime_checkable
8@runtime_checkable
9class Renderable(Protocol):
10 """Protocol for environment sections that can render themselves.
12 This protocol defines the contract for rendering environment info
13 to Rich console output. All environment dataclasses implement this.
14 """
16 @property
17 def section_title(self) -> str:
18 """Return the section title for display (e.g., 'Python')."""
19 ...
21 def to_display_rows(self) -> list[tuple[str, str]]:
22 """Return label-value pairs for rendering.
24 Returns:
25 List of (label, value) tuples. Values can include Rich markup.
26 """
27 ...
29 def is_available(self) -> bool:
30 """Return whether this section has data to display.
32 For optional sections (Node, Rust, Go, Ruby), this returns False
33 when the runtime is not installed. For required sections, always True.
34 """
35 ...