Skip to content

Conversation

@rashmiraghunandan
Copy link
Contributor

@rashmiraghunandan rashmiraghunandan commented Jan 8, 2026

Migrated from deprecated typing.Dict and typing.List to native dict and list types across the entire codebase as part of Python 3.9+ modernization effort (74 files total).

Changes

Type Migrations

  • Updated all type annotations from typing.List/Dict to native list/dict
  • Removed List and Dict imports from 70+ files
  • Migrated test files to use native types

Core Fixes

  • type_helpers.py: Removed legacy list: List normalization mapping, updated is_list() to use native list type
  • type_evaluator.py: Fixed _is_acceptable_candidate() to extract origin types before issubclass() calls (subscripted generics like list[str] cannot be used with issubclass())
  • type_evaluator.py: Updated _is_single_arg_invariant_generic() to check for native list instead of typing.List

Test Updates

  • Updated 3 test expectation files (.txt) to reflect new error messages showing list[...] instead of List[...]
  • Updated test files to use native types and removed unsupported type tests that are now supported
  • Updated test_type_evaluator.py: Removed Union[list[str], str] and bare list from unsupported types (now supported with native types)

Migration Approach

  1. Manually migrated 6 UI API files to establish pattern
  2. Created automation script for systematic migration of remaining files
  3. Fixed type system compatibility issues
  4. Updated all test expectations

Files Changed (74 total)

  • Engine modules: AST, validators, executors, stdlib, UDF system
  • Worker lib: config, storage, discovery, instrumentation, pub/sub
  • UI API: validators, views, lib modules
  • Tests: unit tests and test expectation files

All type checking (mypy), linting (ruff), and integration tests pass.

Fixes #25

@rashmiraghunandan rashmiraghunandan marked this pull request as draft January 8, 2026 19:13
@rashmiraghunandan rashmiraghunandan force-pushed the rashmir/migrate-ui-api-types-issue-25 branch 7 times, most recently from 040a2de to abc74dd Compare January 8, 2026 23:21
Migrate from typing.List/Dict to Python 3.9+ native list/dict types
across the entire codebase. This includes:

- Updating type annotations in all modules
- Fixing type helpers to handle native generic types
- Updating test expectations to reflect new type display strings
- Fixing issubclass() calls to work with subscripted generics

Fixes roostorg#25

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
@rashmiraghunandan rashmiraghunandan force-pushed the rashmir/migrate-ui-api-types-issue-25 branch from abc74dd to 98b36eb Compare January 9, 2026 04:17
@rashmiraghunandan rashmiraghunandan marked this pull request as ready for review January 9, 2026 20:23
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.

migrate python collection types from typing types to native types (i.e. List[str] -> list[str])

1 participant