@@ -34,11 +34,38 @@ dependencies = ["typing_extensions", "pycparser"]
3434[project .optional-dependencies ]
3535dev = [
3636 " rich" ,
37+ " ty" ,
3738]
3839
3940[tool .setuptools .packages .find ]
4041include = [" libdestruct*" ]
4142
43+ [tool .ty .src ]
44+ exclude = [" test/" , " build/" ]
45+
46+ [tool .ty .rules ]
47+ # -- Dynamic metaclass/descriptor inflation pattern --
48+ # The type registry, struct metaclass, and descriptor protocol resolve attributes
49+ # at runtime in ways that ty cannot yet follow (_type_impl, _member_offsets, etc).
50+ unresolved-attribute = " ignore"
51+
52+ # -- Rules that caught real bugs --
53+ # Keep as warn until annotations are improved, then promote to error.
54+ invalid-return-type = " warn" # union.diff() returns dict, ptr.__getitem__ returns bytes
55+ invalid-argument-type = " warn" # union.__init__ passes None as Resolver
56+ invalid-type-form = " warn" # lowercase `callable`, `iter` as type, `...` as annotation
57+ missing-argument = " warn" # wrong _backing_type: type[obj] (should be obj) in enum/flags
58+ too-many-positional-arguments = " warn" # array.__setitem__ calls set() with wrong arity
59+
60+ # -- Intentional design patterns --
61+ invalid-method-override = " warn" # deliberate param narrowing in _set/set overrides (LSP)
62+ invalid-assignment = " warn" # _backing_type instance vs type confusion; descriptor __set__
63+ unsupported-operator = " warn" # obj.get() returns `object`, operators on result untypeable
64+ call-non-callable = " warn" # dynamic inflater dispatch: resolved_type(resolver)
65+ not-subscriptable = " warn" # object.__setattr__ hides dict types from checker
66+ no-matching-overload = " warn" # untyped dict in struct_parser
67+ invalid-yield = " warn" # yield from dynamic __getitem__ typed as object
68+
4269[tool .ruff ]
4370line-length = 120
4471indent-width = 4
0 commit comments