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

Add GitHub Action mypy.yml to mypy --ignore-missing-imports #4274

Closed
wants to merge 5 commits into from

Conversation

cclauss
Copy link
Member

@cclauss cclauss commented Mar 19, 2021

Describe your change:

Add testing for #4052 by running mypy --ignore-missing-imports on all directories that currently pass mypy tests.

I tried to add mypy testing to our pre-commits but #4272 was more pain than it was worth.

  • Add an algorithm?
  • Fix a bug or typo in an existing algorithm?
  • Documentation change?
  • Add GitHub Action mypy.yml

Checklist:

  • I have read CONTRIBUTING.md.
  • This pull request is all my own work -- I have not plagiarized.
  • I know that pull requests will not be merged if they fail the automated tests.
  • This PR only changes one algorithm file. To ease review, please open separate PRs for separate algorithms.
  • All new Python files are placed inside an existing directory.
  • All filenames are in all lowercase characters with no spaces or dashes.
  • All functions and variable names follow Python naming conventions.
  • All function parameters and return values are annotated with Python type hints.
  • All functions have doctests that pass the automated testing.
  • All new algorithms have a URL in its comments that points to Wikipedia or other similar explanation.
  • If this pull request resolves one or more open issues then the commit message contains Fixes: #{$ISSUE_NO}.

@cclauss cclauss requested a review from dhruvmanila as a code owner March 19, 2021 09:51
@ghost ghost added awaiting reviews This PR is ready to be reviewed tests are failing Do not merge until tests pass labels Mar 19, 2021
@cclauss cclauss requested a review from l3str4nge March 19, 2021 10:31
@cclauss cclauss changed the title Add GitHub Action mypy.yml Add GitHub Action mypy.yml to mypy --ignore-missing-imports Mar 19, 2021
@dhruvmanila
Copy link
Member

The thing with mypy is it needs the additional dependencies for it to able to carry out the checks properly. This means we should add the job to our existing CI which already installs the dependencies.

@cclauss
Copy link
Member Author

cclauss commented Mar 20, 2021

--ignore-missing-imports

@dhruvmanila
Copy link
Member

The flag --ignore-missing-imports is only for the imports whose types are missing. mypy usually complains if the type hints are missing from any imported module. This flag will make the type hint for those modules as any.

For the modules which do contain type hints, they will be used by mypy to do the validation even if this flag was passed.

@cclauss
Copy link
Member Author

cclauss commented Mar 20, 2021

Closing in favor of #4276

@cclauss cclauss closed this Mar 20, 2021
@cclauss cclauss deleted the Add-GitHub-Action-mypy.yml branch March 20, 2021 05:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
awaiting reviews This PR is ready to be reviewed
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants