Skip to content

chore: Migrate to ty type checking - #278

Open
toby-coleman wants to merge 11 commits into
mainfrom
copilot/migrate-to-ty-type-checking
Open

chore: Migrate to ty type checking#278
toby-coleman wants to merge 11 commits into
mainfrom
copilot/migrate-to-ty-type-checking

Conversation

@toby-coleman

Copy link
Copy Markdown
Contributor

Summary

Migrate from mypy to ty for type-checking. Significantly faster lint checks.

Changes

  • Swaps output mypy and replaces with ty.
  • Updated documentation.
  • Updates to code where required.

@toby-coleman toby-coleman changed the title Copilot/migrate to ty type checking chore: Migrate to ty type checking Aug 19, 2026
@github-actions

Copy link
Copy Markdown

Benchmark comparison for 712ef942 (base) vs b03c6e2b (PR)


------------------------------------------------------------------------------------------------------------------ benchmark: 2 tests -----------------------------------------------------------------------------------------------------------------
Name (time in ms)                                                                         Min                 Max                Mean            StdDev              Median               IQR            Outliers     OPS            Rounds  Iterations
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
test_benchmark_process_run (main/.benchmarks/Linux-CPython-3.14-64bit/0001_base)     546.7495 (1.0)      554.8212 (1.00)     550.6825 (1.00)     3.2229 (2.21)     549.4150 (1.00)     4.7800 (2.77)          2;0  1.8159 (1.00)          5           1
test_benchmark_process_run (pr/.benchmarks/Linux-CPython-3.14-64bit/0001_pr)         548.5126 (1.00)     552.2200 (1.0)      549.8147 (1.0)      1.4561 (1.0)      549.3233 (1.0)      1.7285 (1.0)           1;0  1.8188 (1.0)           5           1
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

Legend:
  Outliers: 1 Standard Deviation from Mean; 1.5 IQR (InterQuartile Range) from 1st Quartile and 3rd Quartile.
  OPS: Operations Per Second, computed as 1 / Mean

@codecov

codecov Bot commented Aug 19, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 95.55556% with 2 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
plugboard/library/llm.py 33.33% 1 Missing and 1 partial ⚠️

📢 Thoughts on this report? Let us know!

@github-actions

Copy link
Copy Markdown

Benchmark comparison for 78e8f549 (base) vs 87dd8bd6 (PR)


------------------------------------------------------------------------------------------------------------------ benchmark: 2 tests -----------------------------------------------------------------------------------------------------------------
Name (time in ms)                                                                         Min                 Max                Mean            StdDev              Median               IQR            Outliers     OPS            Rounds  Iterations
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
test_benchmark_process_run (main/.benchmarks/Linux-CPython-3.14-64bit/0001_base)     369.9486 (1.0)      396.5094 (1.0)      382.0568 (1.0)      9.4584 (1.00)     381.1066 (1.00)     7.3778 (1.10)          2;0  2.6174 (1.0)           5           1
test_benchmark_process_run (pr/.benchmarks/Linux-CPython-3.14-64bit/0001_pr)         377.8546 (1.02)     400.0086 (1.01)     383.2194 (1.00)     9.4255 (1.0)      379.3404 (1.0)      6.6933 (1.0)           1;1  2.6095 (1.00)          5           1
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

Legend:
  Outliers: 1 Standard Deviation from Mean; 1.5 IQR (InterQuartile Range) from 1st Quartile and 3rd Quartile.
  OPS: Operations Per Second, computed as 1 / Mean

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Migrates project type checking from mypy to ty across tooling, CI, documentation, and source annotations.

Changes:

  • Replaces mypy dependencies and commands with ty.
  • Updates annotations, tests, documentation, and development configuration.
  • Fixes the .pre-commit-config.yaml hook configuration before approval.

Reviewed changes

Copilot reviewed 28 out of 30 changed files in this pull request and generated 1 comment.

Show a summary per file
File Summary
uv.lock Updates locked type-checking dependencies.
tests/unit/test_schemas.py Adds explicit test fixture typing.
tests/unit/test_llm.py Narrows structured response typing.
tests/integration/test_tuner.py Adds result assertions and safe callable-name access.
tests/integration/test_job_id_wiring.py Narrows the built process type.
tests/integration/test_component_decorator.py Adds process type narrowing.
README.md Documents ty usage.
pyproject.toml Replaces mypy configuration and dependency.
plugboard/utils/ray.py Makes callable-name access type-safe.
plugboard/utils/logging.py Improves IPython detection.
plugboard/state/state_backend.py Adds state serialization annotations.
plugboard/library/sql_io.py Refines SQL and async reflection typing.
plugboard/library/llm.py Validates structured response payloads.
plugboard/events/event_handlers.py Safely resolves method qualified names.
plugboard/connector/ray_channel.py Updates channel signatures and annotations.
plugboard/connector/asyncio_channel.py Updates channel message parameter naming.
plugboard/component/utils.py Adds callable protocol typing and narrowing.
plugboard/component/component.py Adds event-list type casts.
plugboard/__init__.py Makes package version lookup robust.
plugboard-schemas/pyproject.toml Removes obsolete mypy configuration.
plugboard-schemas/plugboard_schemas/_validator_registry.py Safely formats callable names.
plugboard-schemas/plugboard_schemas/__init__.py Makes version lookup robust.
Makefile Runs ty during linting.
CONTRIBUTING.md Documents ty and lint commands.
AGENTS.md Updates type-checking guidance.
.pre-commit-config.yaml Critical: the configured ty hook repository, revision, and ID cannot be resolved; use the matching ty-check metadata.
.gitignore Removes mypy cache entries.
.github/workflows/lint-test.yaml Uses ty in CI.
.github/agents/lint.agent.md Updates lint-agent instructions.
.devcontainer/devcontainer.json Adds the ty editor extension.
Suppressed comments (1)

plugboard/connector/ray_channel.py:56

  • RayChannel is a public channel and does not call Channel.__init__, so this method is exposed directly. Renaming its parameter from item to msg makes existing keyword calls such as await channel.send(item=value) fail with TypeError; this is an API break unrelated to the type-check migration. Preserve the old keyword (or explicitly support both names) while keeping the base-method typing consistent.
    async def send(self, msg: _t.Any) -> None:
        """Sends an item through the `RayChannel`."""
        await self._actor.send.remote(msg)  # type: ignore

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread .pre-commit-config.yaml Outdated
Comment on lines +15 to +17
rev: v0.0.73
hooks:
- id: mypy
additional_dependencies:
- types-PyYAML
- types-requests
- pydantic
- msgspec[yaml]
- id: ty
Co-authored-by: toby-coleman <13170610+toby-coleman@users.noreply.github.com>
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.

3 participants