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

Make it easier for contributors to run cross-platform mypy checks #7525

Open
chrahunt opened this issue Dec 29, 2019 · 2 comments
Open

Make it easier for contributors to run cross-platform mypy checks #7525

chrahunt opened this issue Dec 29, 2019 · 2 comments
Labels
state: needs discussion This needs some more discussion type: maintenance Related to Development and Maintenance Processes

Comments

@chrahunt
Copy link
Member

chrahunt commented Dec 29, 2019

What's the problem this feature will solve?

Currently when mypy is run only compatibility with the current platform is tested. Some APIs are platform-dependent, and by default mypy will only detect that if it is running on the platform in question.

This makes it harder to ensure that typing checks will succeed on all platforms (which will matter after #7520 is merged), which could be a surprise for contributors that took the time to run the lint checks locally.

Describe the solution you'd like

mypy supports a --platform flag (docs). We should configure pre-commit so that mypy is executed by default for all combinations of Linux, macOS, and Windows for Python 2 and 3.

How fast this is will depend on the criteria mypy uses for its cache.

Alternative Solutions

  • conditional checks - pre-commit supports skipping hooks by name, and an alias option. With these together it should be possible to come up with a default behavior for contributors that are running tox -e lint, but still allow us to reduce the amount of local configuration changes that contributors wanting faster or more thorough checks have to maintain.
  • do nothing, let CI handle it
  • everyone individually comes up with a local solution

Additional context

@chrahunt chrahunt added state: needs discussion This needs some more discussion type: maintenance Related to Development and Maintenance Processes labels Dec 29, 2019
@pfmoore
Copy link
Member

pfmoore commented Dec 29, 2019

How much extra time will this take? I'd rather users ran mypy ckecks locally on just one platform than thought that it takes too long to run full checks locally and let CI do all of them.

For context, I typically run barely any checks locally, as the test suite takes way too long to be practical on Windows, so I generally just don't bother at all and let CI handle everything.

I'd personally be far more in favour of making faster, but still useful, subsets of the full set of tests more discoverable, rather than making the existing tests take longer by default.

@sbidoul
Copy link
Member

sbidoul commented Dec 29, 2019

I have pre-commit running locally on each commit and while it's currently okay-ish, it would start hurting if it became slower.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
state: needs discussion This needs some more discussion type: maintenance Related to Development and Maintenance Processes
Projects
None yet
Development

No branches or pull requests

3 participants