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 Mypy support #17

Merged
merged 6 commits into from
Feb 10, 2020
Merged

Add Mypy support #17

merged 6 commits into from
Feb 10, 2020

Conversation

ascandella
Copy link
Contributor

@ascandella ascandella commented Feb 9, 2020

Mypy (https://mypy.readthedocs.io/en/stable/) is a static type checker for Python. It lets you optionally type your code using type hints, which are basically ignored by the Python runtime.

Note that mypy runs a little differently than some of the other linters -- because it needs to understand your imports, you generally run it on an entire project, not just a set of files. The way I wrote it is that it ignores the extensions configuration option, and defaults to running mypy against the project directory. If you want to run mypy against a subset of your project, you can pass the directory name(s) as mypy_args and then the linter will skip adding the project directory.

I got some baffling windows failures on test runs, leading to me changing the way python requirements are installed during the github test action run. I still don't understand why this fixes it, but you can see in the last two commits of ascandella#1 that installing as one shot fixes it:

Broken: https://github.com/ascandella/lint-action/runs/434789642#step:9:57
Working: https://github.com/ascandella/lint-action/runs/434838676#step:9:1

I don't have a windows machine available to me to debug further.

Otherwise this fails mysteriously on Windows only with an exit code 1
but no actual errors.
@ascandella
Copy link
Contributor Author

@samuelmeuli samuelmeuli added the enhancement New feature or request label Feb 10, 2020
@samuelmeuli samuelmeuli changed the title Add mypy python linter Add Mypy support Feb 10, 2020
@samuelmeuli samuelmeuli merged commit b6bd9ac into wearerequired:master Feb 10, 2020
@samuelmeuli
Copy link
Collaborator

Really nice work, thanks a lot for your contribution! 🙂

@ascandella
Copy link
Contributor Author

Awesome, thanks for your project and the quick responses, it's very useful!

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jun 4, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants