Repository navigation
MAINT Fix canonical typing - #3064
Open
Roman Lutz (romanlutz) wants to merge 1 commit into
Open
Roman Lutz (romanlutz) wants to merge 1 commit into
Roman Lutz (romanlutz) wants to merge 1 commit into
Conversation
Align test-helper import roots, correct fixture and mock contracts, and preserve decorator signatures without relaxing checker rules. Keep legacy validation and teardown behavior covered. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
The existing production-plus-unit typing check fails even when production typing passes. Unresolved test-helper imports account for much of the noise, but fixture annotations, mock return types, signature-erasing decorators, and several real test defects also need correction.
This restores the complete
pyrit tests\unitcheck without weakening checker rules:unit.*andend_to_end.*. Keepmake tyon its existing production-plus-unit scope with locked dependencies and all extras.Production model/scorer APIs, CI hook scope, checker severities, and directory-level overrides are unchanged. Two line-specific ty exemptions retain deliberately invalid positional construction and an intentionally unresolved annotation. Integration, partner-integration, and top-level build-script typing remediation remains separate and was not rerun.
No breaking runtime API change is intended.
Tests and Documentation
Validated in this worktree with Python 3.13.13, uv 0.11.8, ty 0.0.84, and all extras:
uv run --frozen --no-sync ty check pyrit --output-format conciseuv run --frozen --no-sync ty check pyrit tests\unit --output-format conciseuv run --frozen --no-sync ruff check $changeduv run --frozen --no-sync ruff format --check $changeduv run --frozen --no-sync -m pytest -n 4 --dist=loadfile -q --disable-warnings $files$filescontains all changed test modulesuv run --frozen --no-sync -m pytest -n 4 --dist=loadfile tests\unit -q --disable-warningsuv run --frozen --extra all --link-mode=copy ty check pyritUV_PYTHONset to the owned Python 3.13 interpreter; no hooks bypassedThe runtime runs used Hugging Face/Transformers/datasets offline settings.
makeis unavailable on this Windows host, so the full-suite command runs the Makefile's four-worker unit-test recipe while retaining the owned all-extras environment.Full-suite caveat: The unchanged
tests\unit\setup\test_reinitialization.py::test_replacement_precedence_interpolation_empty_and_omissionmocks setting CentralMemory without installing a memory fixture. It passes in isolation without target configuration, but fails when endpoint, key, and model environment variables cause the real target initializer to construct a target. Process-local dummy configuration reproduces the same failure under both the current helper roots and the originalpythonpath=.. The test, unit fixture file, and traceback source files are unchanged from the starting HEAD. This is not a green full-suite result or a clean-HEAD full-suite comparison; the unrelated fixture issue is left unchanged.Updated the local development guide to distinguish production, canonical, and expanded typing commands and explain interpreter versus checker target versions. Added tests for typed decorator forwarding/results and optional-task cleanup; retained legacy constructor-alias, negative-input, and cancellation coverage.
JupyText was not run; no notebook or executable documentation example was changed.