Feature description
This is a bite-sized, self-contained slice of the ty gradual-typing baseline tracked in #15187 — un-ignoring the invalid-assignment rule.
Right now [tool.ty] in pyproject.toml carries rules.invalid-assignment = "ignore". On a synced 3.14 environment ty reports 23 invalid-assignment diagnostics across 9 files — all small, local fixes (mostly linked-list/tree node attributes typed Node | None where a plain Node or None is assigned, plus a couple of narrow subscript/annotation mismatches). No cross-file churn, so it makes a clean good-first-issue.
Current diagnostics
cellular_automata/conways_game_of_life.py
cellular_automata/one_dimensional.py
data_structures/binary_tree/non_recursive_segment_tree.py
data_structures/heap/binomial_heap.py
data_structures/linked_list/doubly_linked_list.py
data_structures/linked_list/singly_linked_list.py
fractals/mandelbrot.py
machine_learning/automatic_differentiation.py
networking_flow/minimum_cut.py
How to fix
uv sync, then run ty check --exclude-scripts and grep the output for invalid-assignment.
- Fix only these files — usually by widening/narrowing an attribute or variable annotation (e.g. typing a node's
next/previous/left as Node | None at declaration), never by loosening runtime behaviour. Leave every other still-ignored rule untouched.
- Delete the
rules.invalid-assignment = "ignore" line in [tool.ty].
- Confirm
ty reports zero invalid-assignment diagnostics, and that the existing test/doctest suite still passes, then open the PR.
Keep the PR scoped to this one rule so it stays easy to review. Happy to review when it's up.
Additional context
Part of #15187. Please comment to claim before starting so we don't get duplicate PRs.
Feature description
This is a bite-sized, self-contained slice of the
tygradual-typing baseline tracked in #15187 — un-ignoring theinvalid-assignmentrule.Right now
[tool.ty]inpyproject.tomlcarriesrules.invalid-assignment = "ignore". On a synced 3.14 environmenttyreports 23invalid-assignmentdiagnostics across 9 files — all small, local fixes (mostly linked-list/tree node attributes typedNode | Nonewhere a plainNodeorNoneis assigned, plus a couple of narrow subscript/annotation mismatches). No cross-file churn, so it makes a clean good-first-issue.Current diagnostics
cellular_automata/conways_game_of_life.pycellular_automata/one_dimensional.pydata_structures/binary_tree/non_recursive_segment_tree.pydata_structures/heap/binomial_heap.pydata_structures/linked_list/doubly_linked_list.pydata_structures/linked_list/singly_linked_list.pyfractals/mandelbrot.pymachine_learning/automatic_differentiation.pynetworking_flow/minimum_cut.pyHow to fix
uv sync, then runty check --exclude-scriptsand grep the output forinvalid-assignment.next/previous/leftasNode | Noneat declaration), never by loosening runtime behaviour. Leave every other still-ignored rule untouched.rules.invalid-assignment = "ignore"line in[tool.ty].tyreports zeroinvalid-assignmentdiagnostics, and that the existing test/doctest suite still passes, then open the PR.Keep the PR scoped to this one rule so it stays easy to review. Happy to review when it's up.
Additional context
Part of #15187. Please comment to claim before starting so we don't get duplicate PRs.