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

Don't run mypy self-test? #4333

Closed
srittau opened this issue Jul 17, 2020 · 7 comments · Fixed by #4723
Closed

Don't run mypy self-test? #4333

srittau opened this issue Jul 17, 2020 · 7 comments · Fixed by #4723
Labels
project: policy Organization of the typeshed project

Comments

@srittau
Copy link
Collaborator

srittau commented Jul 17, 2020

I suggest to turn off the mypy self test in CI. These tests are the slowest tests by far, taking over 20 minutes to complete, compared to the 7 minutes it takes the pytest tests to complete. When they fail, they also require the feared "typeshed/mypy" shuffle that only mypy/typeshed maintainers (effectively Jelle) can do.

On the other hand, I can't remember the last time these tests flagged a genuine problem with the stubs. (But I don't have the best memory.) If they fail, it's usually due to a tight coupling between the self test and the way things are typed in typeshed.

As with #4332, the main disadvantage of not running those tests is a higher change of failure of the typeshed sync for mypy failing. But I'd argue that it is easier to resolve at sync time than to do the whole shuffle.

@srittau srittau added the project: policy Organization of the typeshed project label Jul 17, 2020
@srittau
Copy link
Collaborator Author

srittau commented Jul 17, 2020

@JukkaL
Copy link
Contributor

JukkaL commented Jul 17, 2020

What about only running mypy self check, as discussed in #4332? It runs pretty quickly.

I assume we'd still verify that mypy can type check the stubs without errors?

I wonder how fast we could make the CI. For example, it would be nice if the CI would run in, say, under 5 minutes for most PRs. Also, once we get to a certain level of CI performance, we can have a policy of rejecting new tests that take longer than that to run, as otherwise things tend to regress over time.

@srittau
Copy link
Collaborator Author

srittau commented Jul 17, 2020

Running mypy over the stubs would not be affected. I like the idea of running the self check, but not the test suite. I especially like Jelle's suggestion for a black-prime-like system. Testing stubs against real work code bases is very useful.

@srittau
Copy link
Collaborator Author

srittau commented Jul 17, 2020

To clarify my suggestion:

  • Check stubs with mypy against various Python versions and platforms (currently the various "mypy" jobs on CI): Keep (possibly pinning the mypy version).
  • Check the mypy code base (currently one part of the "mypy self test" job on CI): Keep, possibly extend to other code bases (possibly using a released mypy version).
  • Run mypy's test suite (currently the other part of the "mypy self test" job on CI): Remove.

@JelleZijlstra
Copy link
Member

To make CI faster, perhaps we can somehow set up a system that checks only the files changed by a PR; that could especially make sense once we move to modular typeshed.

@srittau
Copy link
Collaborator Author

srittau commented Jul 17, 2020

#4337 is a draft PR that adds a "real" mypy self test. For now it just renames (but still runs) the existing self test to "mypy test suite". Interestingly, it flags a few things in mypy's code base.

@hauntsaninja
Copy link
Collaborator

I got #4337 green and merged. I propose for now we change "mypy test suite" to run a subset of tests that are more relevant to typeshed: python/mypy#9638
This should speed things up enough that slowness is hopefully no longer a reason to nix the test completely. I agree that the shuffle is annoying when it's needed, but the typeshed/mypy maintainer bus factor is now two.
Finally, we do check mypy's code base as part of mypy primer, so perhaps once we've figured out what the best way to integrate it into CI is (#4672) we could consider dropping "mypy checks mypy" as redundant (depending on how strict / visible mypy_primer failures are).

hauntsaninja pushed a commit to hauntsaninja/typeshed that referenced this issue Oct 27, 2020
Only a subset of mypy's test suite should be relevant to typeshed:
python/mypy#9638
This should make things faster.
(Also the -n12 argument to pytest is weird; note mypy's pytest.ini
automatically specificies -nauto which is what we should want)

Resolves python#4333
srittau pushed a commit that referenced this issue Oct 28, 2020
Only a subset of mypy's test suite should be relevant to typeshed:
python/mypy#9638
This should make things faster.
(Also the -n12 argument to pytest is weird; note mypy's pytest.ini
automatically specificies -nauto which is what we should want)

Resolves #4333

Co-authored-by: hauntsaninja <>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
project: policy Organization of the typeshed project
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants