Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,11 @@ jobs:
- name: Install dependencies
run: poetry install

- name: Run typechecking
- name: Run mypy typechecking
run: poetry run mypy

- name: Run ty typechecking
run: poetry run ty check

- name: Run tests
run: poetry run pytest
515 changes: 311 additions & 204 deletions poetry.lock

Large diffs are not rendered by default.

5 changes: 3 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ build-backend = "poetry.core.masonry.api"
name = "cleo"
version = "3.0.0.dev0"
description = "Cleo allows you to create beautiful and testable command-line interfaces."
requires-python = ">=3.9"
requires-python = ">=3.10"
authors = [
{ name = "Sébastien Eustace", email = "sebastien@eustace.io" }
]
Expand Down Expand Up @@ -49,7 +49,8 @@ dev = [
"gha-update ; python_full_version >= '3.12'",
]
types = [
"mypy >= 1.18",
"mypy >= 2",
"ty >= 0.0.104",
]
test = [
"pytest >= 8.3.5",
Expand Down
4 changes: 2 additions & 2 deletions src/cleo/_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ def __init__(self) -> None:
self.reset()
self.fed: list[str] = []

def handle_data(self, d: str) -> None:
self.fed.append(d)
def handle_data(self, data: str) -> None:
self.fed.append(data)

def handle_entityref(self, name: str) -> None:
self.fed.append(f"&{name};")
Expand Down
2 changes: 1 addition & 1 deletion src/cleo/commands/command.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ class Command:
hidden = False

def __init__(self) -> None:
self._io: IO = None # type: ignore[assignment]
self._io: IO = None # type: ignore[assignment] # ty: ignore[invalid-assignment]
self._definition = Definition()
self._full_definition: Definition | None = None
self._application: Application | None = None
Expand Down
2 changes: 1 addition & 1 deletion src/cleo/io/inputs/input.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class Input:

def __init__(self, definition: Definition | None = None) -> None:
self._definition: Definition
self._stream: TextIO = None # type: ignore[assignment]
self._stream: TextIO = None # type: ignore[assignment] # ty: ignore[invalid-assignment]
self._options: dict[str, Any] = {}
self._arguments: dict[str, Any] = {}
self._interactive: bool | None = None
Expand Down
6 changes: 4 additions & 2 deletions src/cleo/ui/progress_indicator.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@


if TYPE_CHECKING:
from collections.abc import Iterator
from collections.abc import Generator
from re import Match

from cleo.io.outputs.output import Output
Expand Down Expand Up @@ -129,7 +129,9 @@ def finish(self, message: str, reset_indicator: bool = False) -> None:
self._started = False

@contextmanager
def auto(self, start_message: str, end_message: str) -> Iterator[ProgressIndicator]:
def auto(
self, start_message: str, end_message: str
) -> Generator[ProgressIndicator]:
"""
Auto progress.
"""
Expand Down
3 changes: 1 addition & 2 deletions src/cleo/ui/table.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,8 +110,7 @@ def set_column_max_width(self, column_index: int, width: int) -> Table:

def set_headers(self, headers: Header | list[Header]) -> Table:
if headers and not isinstance(headers[0], list):
headers = cast("Header", headers)
headers = [headers]
headers = [headers] # ty: ignore[invalid-assignment]

headers = cast("list[Header]", headers)

Expand Down
2 changes: 1 addition & 1 deletion tests/ui/exception_trace/test_frame.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ def test_frame() -> None:

def test_frame_with_no_context_should_return_empty_line() -> None:
frame = Frame(
inspect.FrameInfo(None, "filename.py", 123, "function", None, 3) # type: ignore[arg-type]
inspect.FrameInfo(None, "filename.py", 123, "function", None, 3) # type: ignore[arg-type] # ty: ignore[invalid-argument-type]
)

assert frame.line == ""
Loading