Skip to content

Add ty type checker#38

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

Add ty type checker#38
shuckc wants to merge 6 commits intomasterfrom
add-ty-type-checker

Conversation

@shuckc
Copy link
Copy Markdown
Member

@shuckc shuckc commented Feb 24, 2026

This PR adds the "ty" type checker and makes several improvements to type hints so that it passes. The ty type checker is a Python static type checking tool. The changes include upgrading the minimum Python version requirement from 3.8 to 3.10, updating deprecated API usage, improving type annotations, and refactoring code to be more type-checker friendly.

Changes:

  • Adds ty type checker to the development toolchain and CI pipeline
  • Updates minimum Python version requirement from 3.8 to 3.10 and adds support for Python 3.13
  • Fixes deprecated datetime.utcfromtimestamp() calls by replacing them with datetime.fromtimestamp(..., tz=timezone.utc)
  • Refactors HtmlFormatter to use overridable methods instead of constructor parameters for HTML escaping and markup
  • Improves parameter naming consistency in adapter classes (item → value, i → index)
  • Updates asyncio exception handling import from asyncio.exceptions.IncompleteReadError to asyncio.IncompleteReadError
  • Adds explicit MessageType cast for better type safety
  • Improves type annotations for array.array usage

@shuckc shuckc force-pushed the add-ty-type-checker branch from 17d100a to 991bed8 Compare February 24, 2026 10:30
Copy link
Copy Markdown
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

This PR adds the "ty" type checker to the aiokdb project and makes several related improvements. The ty type checker is a Python type checking tool that complements mypy. The changes include upgrading the minimum Python version requirement from 3.8 to 3.10, updating deprecated API usage, improving type annotations, and refactoring code to be more type-checker friendly.

Changes:

  • Adds ty type checker to the development toolchain and CI pipeline
  • Updates minimum Python version requirement from 3.8 to 3.10 and adds support for Python 3.13
  • Fixes deprecated datetime.utcfromtimestamp() calls by replacing them with datetime.fromtimestamp(..., tz=timezone.utc)
  • Refactors HtmlFormatter to use overridable methods instead of constructor parameters for HTML escaping and markup
  • Improves parameter naming consistency in adapter classes (itemvalue, iindex)
  • Updates asyncio exception handling from asyncio.exceptions.IncompleteReadError to asyncio.IncompleteReadError
  • Adds explicit MessageType cast for better type safety
  • Improves type annotations for array.array usage

Reviewed changes

Copilot reviewed 10 out of 11 changed files in this pull request and generated no comments.

Show a summary per file
File Description
requirements.txt Pinned all dependency versions including new ty==0.0.18; contains invalid pytest-asyncio version
requirements.minimal.txt Added ty and ruff to minimal requirements
pyproject.toml Updated Python version requirements to 3.10+ and added ty configuration
check.sh Added ty check to the validation script
.github/workflows/check.yml Updated CI to test Python 3.10-3.13 and run ty check
aiokdb/format.py Replaced deprecated datetime methods, refactored HtmlFormatter to use methods instead of constructor parameters, improved tuple unpacking
aiokdb/server.py Added MessageType cast and updated asyncio exception handling
aiokdb/adapter.py Improved parameter naming for clarity and consistency
aiokdb/init.py Enhanced type annotations for array.array
test/test_format.py Updated test to use new HtmlFormatter method names
README.md Updated documentation to reflect Python 3.10-3.13 support

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

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.

2 participants