Skip to content

Commit 1dca844

Browse files
authored
Bump version to 0.0.69 (#4202)
1 parent 557a078 commit 1dca844

10 files changed

Lines changed: 123 additions & 11 deletions

File tree

‎CHANGELOG.md‎

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,28 @@
11
# Changelog
22

3+
## 0.0.69
4+
5+
Released on 2026-08-06.
6+
7+
### Core type checking
8+
9+
- `isinstance` narrowing for generic classes is now more gradual by default ([#27308](https://github.com/astral-sh/ruff/pull/27308))
10+
11+
This new behavior is more similar to what other major type checkers do. For example:
12+
13+
```py
14+
def f(xs: object):
15+
if isinstance(xs, list):
16+
reveal_type(xs) # now: `list[Unknown]`, before: `Top[list[Unknown]]`
17+
```
18+
19+
**Note**: you might consider enabling [`analysis.strict-generic-narrowing`](https://docs.astral.sh/ty/reference/configuration/#strict-generic-narrowing)
20+
if you prefer the strictly correct behavior.
21+
22+
### Contributors
23+
24+
- [@sharkdp](https://github.com/sharkdp)
25+
326
## 0.0.68
427

528
Released on 2026-08-05.

‎dist-workspace.toml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[workspace]
22
members = ["cargo:./ruff"]
33
packages = ["ty"]
4-
version = "0.0.68"
4+
version = "0.0.69"
55

66
# Config for 'dist'
77
[dist]

‎docs/coming-from-mypy-or-pyright.md‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@ possibly-missing-import = "warn"
7676

7777
[tool.ty.analysis]
7878
strict-literal-narrowing = true
79+
strict-generic-narrowing = true
7980

8081
[tool.ruff.lint]
8182
extend-select = ["ANN", "PYI", "PGH003"]

‎docs/features/type-system.md‎

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -116,8 +116,9 @@ Gradual types generally have two special [materializations]. The top materializa
116116
For example, the top materialization of `Any` is `object`, and the top materialization of
117117
`Any & int` is `int`. For invariant generic classes, the top materialization cannot be expressed in
118118
Python's type system, but it is a useful type that ty intersects with when `isinstance` checks
119-
involve generic classes. For example, when checking `isinstance(…, list)`, ty intersects with the
120-
top materialization of `list[Unknown]`:
119+
involve generic classes (when [`analysis.strict-generic-narrowing`](../reference/configuration.md#strict-generic-narrowing)
120+
is enabled). For example, when checking `isinstance(…, list)`, ty intersects with the top materialization
121+
of `list[Unknown]`:
121122

122123
```py
123124
@final
@@ -129,7 +130,7 @@ def process(items: Item | list[Item]):
129130
reveal_type(items)
130131
```
131132

132-
(Full example in the [playground](https://play.ty.dev/f1306120-0b8d-4ed5-b832-1f2d379eae2b))
133+
(Full example in the [playground](https://play.ty.dev/d2759832-101c-410d-b721-50805729bc68))
133134

134135
!!! info
135136

‎docs/installation.md‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ ty includes a standalone installer.
7171
Request a specific version by including it in the URL:
7272

7373
```console
74-
$ curl -LsSf https://astral.sh/ty/0.0.68/install.sh | sh
74+
$ curl -LsSf https://astral.sh/ty/0.0.69/install.sh | sh
7575
```
7676

7777
=== "Windows"
@@ -87,7 +87,7 @@ ty includes a standalone installer.
8787
Request a specific version by including it in the URL:
8888

8989
```pwsh-session
90-
PS> powershell -ExecutionPolicy ByPass -c "irm https://astral.sh/ty/0.0.68/install.ps1 | iex"
90+
PS> powershell -ExecutionPolicy ByPass -c "irm https://astral.sh/ty/0.0.69/install.ps1 | iex"
9191
```
9292

9393
!!! tip
@@ -163,7 +163,7 @@ COPY --from=ghcr.io/astral-sh/ty:latest /ty /bin/
163163
The following tags are available:
164164

165165
- `ghcr.io/astral-sh/ty:latest`
166-
- `ghcr.io/astral-sh/ty:{major}.{minor}.{patch}`, e.g., `ghcr.io/astral-sh/ty:0.0.68`
166+
- `ghcr.io/astral-sh/ty:{major}.{minor}.{patch}`, e.g., `ghcr.io/astral-sh/ty:0.0.69`
167167
- `ghcr.io/astral-sh/ty:{major}.{minor}`, e.g., `ghcr.io/astral-sh/ty:0.0` (the latest patch
168168
version)
169169

‎docs/reference/configuration.md‎

Lines changed: 86 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎docs/reference/typing-faq.md‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -328,7 +328,8 @@ the developer experience around this in the future.
328328

329329
This type represents "all possible lists of any element type" (as opposed to `list[Unknown]`, which
330330
represents "a list of some unknown element type"). It usually arises from a check such as
331-
`if isinstance(x, list):`. If `x` was previously of type `Item | list[Item]`, you might expect this
331+
`if isinstance(x, list):` if you have the [`analysis.strict-generic-narrowing`](../reference/configuration.md#strict-generic-narrowing)
332+
option enabled. If `x` was previously of type `Item | list[Item]`, you might expect this
332333
check to narrow the type to `list[Item]`, but ty respects the possibility that there could be a
333334
common subclass of both `Item` and `list` (which may not be a list of `Item`!), and so the narrowed
334335
type is instead `(Item & Top[list[Unknown]]) | list[Item]`. This code can be made more robust by

‎pyproject.toml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[project]
22
name = "ty"
3-
version = "0.0.68"
3+
version = "0.0.69"
44
requires-python = ">=3.8"
55
dependencies = []
66
description = "An extremely fast Python type checker, written in Rust."

‎uv.lock‎

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)