Release Notes
Released on 2026-12-03.
Bug fixes
- Report
invalid-assignmentfor unsupported item or slice assignments even after a check such asout is not Nonenarrows anobject. (#30011) - Check assignments to a Django model instance’s
pkusing the underlying field’s write type, including Django expressions where the field accepts them. On the model class,pkhas typeproperty, so accessing a primary-key value attribute such asBook.pk.hexreportsmissing-attribute. (#31269) - Infer the stored ID type for a Django relation’s
<field>_idwhento_fieldnames another relation. If the field is also the primary key,pkgets the same ID type. (#31268) - Preserve the
NewTypewhen a protocol uses a method whose return annotation isSelf. For example,ExitStack.enter_contextnow returns the wrapped context manager’sNewTypewhen its__enter__returnsSelf. (#31211) - Preserve attribute types when a
NewTypewraps a class, including enum values, attributes supplied by a metaclass, and assignment types from dataclass field converters. Protocol checks use those types too. (#31234) - Infer enum members’
nameandvalueattributes using Python’s override rules, including cases where an inheritedenum.propertysupplies the value or a bare annotation leaves the generated property in place. (#31234) - Recognize that a
NewTypebased onobjectcan hold unhashable values, including through nestedNewTypes. The negative branch of anisinstance(value, Hashable)check remains reachable, and unions withHashableretain both alternatives. (#31232) - Report
cyclic-class-definitionfor every class that participates in overlapping inheritance cycles, regardless of the order of its base classes. (#31298) - Report
invalid-type-formwhen an IPython escape command such as!pwdappears where a type is expected in a notebook, preventing a crash. (#31238) - Fix false slot conflicts and missing-attribute errors when a lambda in a class-body loop uses
:=to bind a local variable with the same name as a slot. (#31150) - Highlight references only in the requested notebook cell so references in other cells don’t highlight unrelated code. (#31243)
- Limit notebook document outlines to symbols defined in the requested cell. (#31243)
- Fade the correct code in each notebook cell when an unreachable region spans multiple cells. (#31248)
LSP server
- Offer completions for generated attributes and methods on Django model classes and instances, including inherited members such as foreign-key IDs, choice display methods, and date navigation methods. (#31272)
- Distinguish escape sequences in semantic highlighting for strings, bytes, and the literal parts of f-strings and t-strings. Backslashes in raw strings retain ordinary string highlighting. (#31239)
- Fix Expand Selection in notebooks so it includes intermediate expressions and stops at the current cell’s contents. (#31241)
- Restore code folding for import blocks that end at a notebook cell boundary. (#31241)
- Reduce the work needed for semantic highlighting, reference highlighting, code folding, and document outlines by reusing source text and line positions within each request. (#30669)
CLI
- Show file counts as
ty check --fixandty check --add-ignoreapply edits and recheck the project, with a separate indicator while writing changes. (#31147) - Make completed and remaining work easier to distinguish in progress bars when checking files or syncing script dependencies. (#31200)
Diagnostic improvements
- Add autofixes for
mismatched-*-namediagnostics that make the supplied name match the assignment target.ty check --fixapplies fixes marked safe. Fixes for enums, named tuples, and sentinels are always marked unsafe. (#30628)
Performance improvements
- Reduce work when opening or closing unchanged files with
diagnosticModeset toopenFilesOnlyby reusing prior analysis. ty continues to report diagnostics only for open files. (#31252) - Reduce memory use when looking up a method on a large union of unrelated subclasses that inherit the same method. (#31288)
- Resolve calls with multiple matching overloads faster when ty can rule out later overloads without building unions of the parameter types. (#31250)
- Specialize nested generic types such as
dict[str, list[T]]faster by skippingParamSpecwork for types without callable signatures. (#31195) - Specialize generic types faster by reusing declared variance, such as the invariance of
list’s type parameter. (#31173) - Analyze
tryblocks faster by skipping repeated work to determine what values can reach anexcepthandler when assignments and narrowing conditions are unchanged. (#31260)
Memory usage improvements
- Reduce peak memory while analyzing files with many independent scopes, such as stubs with hundreds of methods. (#31171)
- Use less memory to track which assignments and declarations can reach a given point in the code, especially when there is only one possible definition. (#31168)
- Use less memory when simplifying unions by storing each pair of types once when checking redundancy in both directions. (#31182)
- Reuse unchanged parameter lists when specializing callable types, as when
Callable[[int], T]becomesCallable[[int], str]. (#31161)
Core type checking
- Resolve imports across legacy namespace packages that set
__path__at module scope usingfrom pkgutil import extend_path, including aliases forextend_pathorpkgutil. (#31274) - Infer the tuple length and element types returned by
struct.unpack_fromfrom a known format string. For example,struct.unpack_from("<I?", buf)returnstuple[int, bool]. (#31230) - Infer more precise
TypedDict.getresults for unions of known literal keys when the fields have identical declared types and are either all required or all optional. For optional fields, ty also uses the shared field type to infer defaults such as{}. (#30897) - Resolve inherited method signatures correctly when checking mutually importing files in parallel and a protocol method’s return type refers back to the protocol through
Self. (#29818)
Other changes
- Explain how to install third-party stubs when migrating from Pyright, with
uv add --dev types-PyYAMLas an example, and how ty automatically uses stub packages already installed for mypy. (#5207)
Contributors
- @AlexWaygood
- @ambujone
- @carljm
- @charliermarsh
- @dcreager
- @MichaReiser
- @sharkdp
- @tamird
- @Viicos
- @zaniebot
Install ty 1.1.0
Install prebuilt binaries via shell script
curl --proto '=https' --tlsv1.2 -LsSf https://releases.astral.sh/github/ty/releases/download/1.1.0/ty-installer.sh | shInstall prebuilt binaries via powershell script
powershell -ExecutionPolicy Bypass -c "irm https://releases.astral.sh/github/ty/releases/download/1.1.0/ty-installer.ps1 | iex"Download ty 1.1.0
Verifying GitHub Artifact Attestations
The artifacts in this release have attestations generated with GitHub Artifact Attestations. These can be verified by using the GitHub CLI:
gh attestation verify <file-path of downloaded artifact> --repo astral-sh/tyYou can also download the attestation from GitHub and verify against that directly:
gh attestation verify <file-path of downloaded artifact> --bundle <file-path of downloaded attestation>