Skip to content

Add type annotations#1286

Closed
brianegge wants to merge 2 commits intomorganstanley:mainfrom
brianegge:claude/review-pr-4DhJY
Closed

Add type annotations#1286
brianegge wants to merge 2 commits intomorganstanley:mainfrom
brianegge:claude/review-pr-4DhJY

Conversation

@brianegge
Copy link
Contributor

Bug / Requirement Description

Add type annotations

Solution description

Add type annotations

Checklist:

  • Test
  • Example (both test_plan.py and .rst)
  • Documentation (API)
  • News fragment present for release notes
  • MS info leakage check
  • For new driver: driver index page
  • For new assertion: ui/pdf/std renderers, documentation
  • For new cmdline arg: documentation

brianegge and others added 2 commits March 7, 2026 06:55
Add type annotations across the entire testplan codebase (109 files,
218 checked modules) with zero mypy errors.

Infrastructure:
- Add mypy configuration in pyproject.toml with per-module strict overrides
- Add py.typed marker for PEP 561 compliance
- Add types-paramiko and types-requests stub packages
- Add doit task for running mypy

Key patterns:
- TypeVar-typed `emphasized` decorator to preserve property types
- Targeted `# type: ignore[error-code]` for framework meta-programming
- isinstance/assert narrowing to replace union-attr suppressions
- Python 3.9 compatible (Optional[X] not X | None)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Fix 17 mypy errors for compatibility with mypy 1.19:
  - Add type: ignore[no-any-return] for functions returning Any
  - Add type: ignore[import-untyped] for paramiko/requests imports
  - Remove unused type: ignore comments
  - Fix displaced type: ignore comments after ruff reformatting
- Apply ruff formatting across all files
- Update constraints.txt via uv export

https://claude.ai/code/session_018SqKHFDkaRQHVnZUKukBSe
@brianegge brianegge requested a review from a team as a code owner March 7, 2026 12:53
@brianegge brianegge closed this Mar 7, 2026
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