Skip to content

Comments

add ty type checker#32

Open
shuckc wants to merge 8 commits intomasterfrom
add-ty-type-checker
Open

add ty type checker#32
shuckc wants to merge 8 commits intomasterfrom
add-ty-type-checker

Conversation

@shuckc
Copy link
Member

@shuckc shuckc commented Aug 23, 2025

No description provided.

@shuckc shuckc force-pushed the add-ty-type-checker branch 4 times, most recently from bdf6430 to ff1582d Compare August 23, 2025 21:44
@shuckc shuckc force-pushed the add-ty-type-checker branch from 193272c to b76ff96 Compare February 21, 2026 23:39
@shuckc shuckc force-pushed the add-ty-type-checker branch from 2b40f30 to a7dfc9c Compare February 23, 2026 11:19
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds the ty type checker to the project and adjusts code/types to satisfy stricter type-checking, while also tightening dependency management and CI coverage across Python versions.

Changes:

  • Add ty configuration (pyproject.toml) and run ty check in CI; expand CI matrix to include Python 3.13.
  • Refactor HTML formatting customization to be method-based (html_escape / html_markup) and update tests accordingly.
  • Misc typing/compatibility cleanups (enum typing in server read path, datetime timezone-aware conversions, adaptor overload signatures).

Reviewed changes

Copilot reviewed 8 out of 9 changed files in this pull request and generated 7 comments.

Show a summary per file
File Description
aiokdb/__init__.py Type annotation adjustments for stricter type-checking.
aiokdb/adapter.py Refines overload signatures/parameter naming for indexing & mutation.
aiokdb/format.py Makes datetime formatting timezone-aware; refactors HTML escaping/markup customization.
aiokdb/server.py Tightens message type typing and modernizes asyncio.IncompleteReadError usage.
test/test_format.py Updates formatter subclass test to use new HTML escaping/markup hooks.
requirements.txt Pins tooling/test dependencies and adds ty.
requirements.minimal.txt Introduces a minimal (unpinned) requirements set including ty/ruff.
pyproject.toml Adds ty environment configuration.
.github/workflows/check.yml Adds Python 3.13 and runs ty check in CI with a .venv setup.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

return f"cv({repr(self.aS())})"

def kC(self) -> array.array: # type: ignore[type-arg]
def kC(self) -> array.array:
Copy link

Copilot AI Feb 23, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

KCharArray.kC now returns array.array without a type parameter. In strict mypy this will fail as an unparameterized generic; it should likely be array.array[str] to match the _c: array.array[str] field.

Suggested change
def kC(self) -> array.array:
def kC(self) -> "array.array[str]":

Copilot uses AI. Check for mistakes.
Comment on lines 335 to 344
def __init__(
self,
table_class: Optional[str] = None,
indent: int = 2,
width: int = 200,
height: int = 10,
markup: Callable[[str], str] = identity,
escape: Callable[[str], str] = escape,
):
super().__init__(width, height)
self.tc = f' class="{table_class}"' if table_class else ""
self.indent = indent
Copy link

Copilot AI Feb 23, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

HtmlFormatter.__init__ no longer accepts the previously supported markup / escape callables, which is a breaking API change for any callers that injected custom escaping/markup. If this was intentional, consider keeping these as optional (deprecated) parameters that set the behavior of html_markup/html_escape, or document the new subclassing-based customization path.

Copilot uses AI. Check for mistakes.
Comment on lines +33 to 35
- run: ty check
- run: mypy --strict .
- run: pytest .
Copy link

Copilot AI Feb 23, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CI now runs ty check, but there’s no corresponding update to the repo’s local developer workflow (e.g., check.sh / README’s test instructions). Consider adding ty check to the documented/local check script so contributors can reproduce CI failures locally without guessing.

Copilot uses AI. Check for mistakes.
@shuckc shuckc force-pushed the add-ty-type-checker branch from 621e8f0 to 78396cb Compare February 23, 2026 12:08
@shuckc shuckc force-pushed the add-ty-type-checker branch from 78396cb to ea98681 Compare February 23, 2026 12:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant