Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace types-attrs with attrs #54

Merged
merged 2 commits into from
Nov 20, 2022
Merged

Replace types-attrs with attrs #54

merged 2 commits into from
Nov 20, 2022

Conversation

cdce8p
Copy link
Contributor

@cdce8p cdce8p commented Nov 19, 2022

Blocked by python/mypy#14137

@hauntsaninja
Copy link
Owner

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
Copy link
Contributor

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
Copy link
Contributor Author

cdce8p commented Nov 19, 2022

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.

@cdce8p cdce8p changed the title Install attrs for home-assistant/core Replace types-attrs with attrs [home-assistant] Nov 19, 2022
@cdce8p cdce8p marked this pull request as ready for review November 19, 2022 11:27
@hauntsaninja
Copy link
Owner

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

@cdce8p cdce8p changed the title Replace types-attrs with attrs [home-assistant] Replace types-attrs with attrs Nov 20, 2022
@cdce8p
Copy link
Contributor Author

cdce8p commented Nov 20, 2022

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?

Copy link
Owner

@hauntsaninja hauntsaninja left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you, this looks good!

Good question. primer sets both --no-incremental and --cache-dir=/dev/null. I guess we could set some --cache-dir, we might just want to ensure that all the different concurrent mypys write to different caches. The cost of dropping --cache-dir=/dev/null is basically figuring that out, some extra CI slowness, and some personal dev workflows that I can adjust.

I do confess to being surprised at the existence of an issue this would have caught that wasn't caught by the regular mypy self check. So updating my priors, but still don't think it's critical if we don't do it :-)

@hauntsaninja hauntsaninja merged commit 0aa02da into hauntsaninja:master Nov 20, 2022
@cdce8p cdce8p deleted the cdce8p-patch-1 branch November 20, 2022 10:27
@cdce8p
Copy link
Contributor Author

cdce8p commented Nov 27, 2022

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.
python/mypy#14155

ilevkivskyi pushed a commit to python/mypy that referenced this pull request Dec 19, 2022
Currently, `mypy_primer` sets `--cache-dir=/dev/null` which disables
cache generation. This can result in errors being missed which would
normally come up during `tree.serialize()`. Removing
`--cache-dir=/dev/null` isn't practical.

This PR adds a new debug / test option `--debug-serialize` which runs
`tree.serialize()` even if cache generation is disabled to help detect
serialize errors earlier.

**Refs**
* #14137
*
hauntsaninja/mypy_primer#54 (review)

cc: @hauntsaninja
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants