hauntsaninja / mypy_primer

Run mypy and pyright over millions of lines of code
MIT License
55 stars 29 forks source link

Replace types-attrs with attrs #54

Closed cdce8p closed 1 year ago

cdce8p commented 1 year ago

~Blocked by https://github.com/python/mypy/issues/14137~

hauntsaninja commented 1 year ago

We already install types-attrs. I think the bug is a cache bug, so it won't repro in mypy_primer (which only does from scratch checking). Or at least, I wasn't able to repro with mypy_primer -k home-assistant — are you able to?

AlexWaygood commented 1 year ago

It might be worth removing the types-attrs import and replacing it with attrs regardless of the mypy bug, since types-attrs was deleted from typeshed in June 2021 after attrs introduced inline types, and home-assistant no longer appears to use types-attrs.

cdce8p commented 1 year ago

We already install types-attrs.

🤦🏻 I should have looked more carefully. I just assumed that it wasn't installed since I was able to crash mypy with just attrs or types-attrs installed and the primer didn't catch it.

I think the bug is a cache bug, so it won't repro in mypy_primer (which only does from scratch checking). Or at least, I wasn't able to repro with mypy_primer -k home-assistant — are you able to?

It is a cache bug but one that occurs on the first write / serialize. I'm able to reproduce it with --no-incremental. Interestingly though setting --cache-dir=/dev/null (like the primer does) hides it 🤔

It might be worth removing the types-attrs import and replacing it with attrs

Will do that.

hauntsaninja commented 1 year ago

It looks like there are several projects that use types-attrs instead of attrs, want to upgrade all of them?

cdce8p commented 1 year ago

I think the bug is a cache bug, so it won't repro in mypy_primer (which only does from scratch checking). Or at least, I wasn't able to repro with mypy_primer -k home-assistant — are you able to?

It is a cache bug but one that occurs on the first write / serialize. I'm able to reproduce it with --no-incremental. Interestingly though setting --cache-dir=/dev/null (like the primer does) hides it 🤔

Does it make sense to look for ways to remove the --cache-dir=/dev/null argument? Maybe if we replace it with --no-incremental?

cdce8p commented 1 year ago

It is a cache bug but one that occurs on the first write / serialize. I'm able to reproduce it with --no-incremental. Interestingly though setting --cache-dir=/dev/null (like the primer does) hides it 🤔

I've opened a PR to run serialize even with --cache-dir=/dev/null. Might be useful to have. https://github.com/python/mypy/pull/14155