pyrefly icon indicating copy to clipboard operation
pyrefly copied to clipboard

Pyrefly can't handle `attrs` library (dataclass_transform)

Open estyrke opened this issue 7 months ago • 0 comments

Describe the Bug

Using Pyrefly 0.16.1 and latest attrs 25.3.0:

from attrs import define


@define
class Test:
    test: str


Test(test="test")

I expect this code to be valid, but pyrefly reports

test.py:9:6-17: Unexpected keyword argument `test` in function `object.__init__` [unexpected-keyword]

I think this might boil down to not recognising the @dataclass_transform decorator, see sandbox link below. Both pyright and mypy accept the code in the sandbox.

Sandbox Link

https://pyrefly.org/sandbox/?code=MQAg6gpgNgxg9gWwiALnVALZAFAngJwgDMpcQBlAQwDsATAIzgA8AaTASwGcQuRKQADpQDmEAFCgA7lkIhccAK4gYNEJPzsUENpwyVZNWiCgR91PowUpUuAe2rCe5vCgxxqAOgkSQACQgGBsqKAiYgRKYoCoTccEQc3JyGjEwAXD4AtCAA4hDWhJRQGSjsSDYCyDBYMADW9o4REAyUtZkgAKqcyIQAbqZQAPoothAAFACUqOj2nBUw1vYR+IRGwxWcbRBMFRpI1NaSmhiYyACSACIAouGR0RDcrpQHyJwKAgJw+NajEB7CHnwrHB4AhQnltCBhHBitDaMR7Jp2O42G4+vg2HkYOM2mANFo+HQQPgFM5cK53ME4SBaOxCPNSE45Ip8CB6Pg4JIuvgxGIiOyEOV6jxQZ9rLQni0oJROJwhvgaJwiJ8EDyAALilCS6WylDy6iK5UTMRw+Im+xjIjUcapEAeO1qs3UcQwKUykAAFXuKHSIF9qC9Ns4up5Yk9QdGWiDAF4AESRlAx7FAA

(Only applicable for extension issues) IDE Information

No response

estyrke avatar May 22 '25 07:05 estyrke