astral-sh
ruff
BlogDocsChangelog

Performance History

Latest Results

[ty] fix unary operators on `NewType`s of `float` and `complex` Closes https://github.com/astral-sh/ty/issues/2499.
newtype_unary
1 hour ago
Map pyi code block to pyi source type
amy/ruffen-docs
3 hours ago
[ty] diagnostic on overridden `__setattr__` and `__delattr__` in frozen dataclasses (#21430) ## Summary https://github.com/astral-sh/ty/issues/111 this pr adds an `invalid-dataclass-override` diagnostic when a custom `__setattr__` or `__delattr__` is defined on a dataclass where `frozen=True` ([docs](https://docs.python.org/3/library/dataclasses.html#frozen-instances)) ### Runtime exception ``` Traceback (most recent call last): File "/Users/justinchapman/src/ty-playground/main.py", line 4, in <module> @dataclass(frozen=True) ~~~~~~~~~^^^^^^^^^^^^^ File "/Users/justinchapman/.local/share/uv/python/cpython-3.13.0-macos-aarch64-none/lib/python3.13/dataclasses.py", line 1295, in wrap return _process_class(cls, init, repr, eq, order, unsafe_hash, frozen, match_args, kw_only, slots, weakref_slot) File "/Users/justinchapman/.local/share/uv/python/cpython-3.13.0-macos-aarch64-none/lib/python3.13/dataclasses.py", line 1157, in _process_class func_builder.add_fns_to_class(cls) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^ File "/Users/justinchapman/.local/share/uv/python/cpython-3.13.0-macos-aarch64-none/lib/python3.13/dataclasses.py", line 516, in add_fns_to_class raise TypeError(error_msg) TypeError: Cannot overwrite attribute __setattr__ in class A ``` ### Diagnostic ``` error[invalid-dataclass-override]: Cannot overwrite attribute __setattr__ in class A --> /Users/justinchapman/src/ty-playground/main.py:6:5 | 4 | @dataclass(frozen=True) 5 | class A: 6 | def __setattr__(self, name: str, value: object) -> None: ... | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | info: __setattr__ info: rule `invalid-dataclass-override` is enabled by default Found 1 diagnostic ``` ## Test Plan - new mdtests - e2e - the `attrs` mypy primer diff looks to be a [true positive](https://github.com/python-attrs/attrs/blob/main/tests/test_setattr.py#L373) - the other results have been unpredictable and have changed every time i pushed new code, even if the diagnostic logic didn't change... --------- Co-authored-by: Carl Meyer <carl@astral.sh>
main
4 hours ago
re-use field_policy
thejchap:thejchap/frozen-setattr
4 hours ago

Active Branches

[ty] fix unary operators on `NewType`s of `float` and `complex`
last run
1 hour ago
#22605
CodSpeed Performance Gauge
0%
#22643
CodSpeed Performance Gauge
+5%
last run
3 hours ago
#22470
CodSpeed Performance Gauge
0%
© 2026 CodSpeed Technology
Home Terms Privacy Docs