Avatar for the astral-sh user
astral-sh
ruff
BlogDocsChangelog

Branches performance

Pull requests

[ty] Narrow equality subscripts on either operand#23104
last run
1 hour ago
[ty] Narrow equality subscripts on either operand
3 hours ago
a50cbd2
codex/find-improved-narrowing-case-examples
CodSpeed Performance Gauge
0%
[ty] Allow constrained TypeVars with compatible constraints to satisfy each other When a constrained TypeVar is passed to a function expecting another constrained TypeVar, check whether each constraint of the actual TypeVar is assignable to at least one constraint of the formal TypeVar. This fixes false-positive errors when wrapping functions from external packages that define private TypeVars with the same (or compatible) constraint sets. Fixes https://github.com/astral-sh/ty/issues/2728 https://claude.ai/code/session_01FbdSnWQPg9EZgcwbR5Kujp
2 hours ago
d3499a1
claude/fix-issue-2728-wMAxf
CodSpeed Performance Gauge
0%
[ty] Fix comparison operators with literal type annotations in dunder methods When a class defines a comparison method like `__gt__(self, other: Literal[0])`, using the comparison operator `m > 0` would fail with "Unsupported `>` operation" even though the direct method call `m.__gt__(0)` worked correctly. The issue was in `infer_binary_type_comparison`: when comparing a `NominalInstance` with a literal type (`IntLiteral`, `StringLiteral`, or `BytesLiteral`), the code unconditionally widened the literal to its base type (`int`, `str`, `bytes`) before attempting dunder method lookup. This meant that a method expecting `Literal[0]` would receive `int` instead, causing the type check to fail. The fix modifies the literal + NominalInstance cases to first try the dunder call with the original literal type, then fall back to widening only if that fails. This allows methods annotated with literal types to work correctly while maintaining backward compatibility with methods expecting the base types. Also removes unnecessary catch-all patterns for StringLiteral, BytesLiteral, and LiteralString that were not exercised by any tests. https://claude.ai/code/session_01YMYPi46ZrejvcYnNoqB759
3 hours ago
02bb5f3
claude/fix-money-comparison-type-2tpRu
CodSpeed Performance Gauge
0%
Make root directory fallback more consistent, and improve documentation#23099
last run
2 hours ago
[ty] Clarify that `./src` must not be a package for auto-detection Update the `environment.root` auto-detection to handle `./src`, `./<project-name>`, and `./python` directories uniformly: all three are now additive (any combination can be included), rather than `./src` and `./<project-name>` being mutually exclusive alternatives. The project root (`.`) is always included. Additionally, each of the following directories is included if it exists and is not a package (i.e., does not contain `__init__.py` or `__init__.pyi`): - `./src` - `./<project-name>` (when `./<project-name>/<project-name>` exists) - `./python` This simplifies both the implementation and the documentation. Closes astral-sh/ty#2722 https://claude.ai/code/session_01UrvvEWGPheFEYc1rFbzxA5
3 hours ago
1ae34df
claude/fix-issue-2722-4eEXV
CodSpeed Performance Gauge
0%
© 2026 CodSpeed Technology
Home Terms Privacy Docs