-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
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 definition #11320
Add Github Action definition #11320
Conversation
Define a Github Action that can be used as a canonical way of running mypy as part of Github CI workflows as easy as: jobs: lint: runs-on: ubuntu-latest steps: - uses: python/mypy The action is inspired by its equivalent in black and supports the following options: with: options: "..." # mypy command-line options paths: "." # a list of paths to check version: "0.910" # mypy version to use install_types: yes|no # whether to auto-install stubs
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks pretty reasonable, and could be pretty useful for people. My main question is where the best location to put it is. Does anyone have opinions on this?
Thanks, this does seem like it could be useful. I think it has to be at the root of the repo. Frankly, I wouldn't mind having this live in another repo (similar to how pyright does it https://github.com/jakebailey/pyright-action), the wide variety of project installations and configurations people have might make this an annoying thing to maintain. Speaking of the pyright-action, it does some cool Github magic to have errors show up in your PR, which is pretty nice |
Not necessarily, it can be in a subfolder, e.g.
We can add a problem matcher which would convert mypy errors into Github annotations via regexps. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think its fine to keep it at the toplevel. It also would be awesome to add problem matchers, the annotations in the Github UI are pretty nice.
Thanks! |
Added #11359 to track documentation for this. |
This was broken by python#11320
This was broken by #11320 Co-authored-by: hauntsaninja <>
I am working on #11359, I have some feedback on currect state of mypy's GitHub Action:
name: mypy
jobs:
lint:
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
with:
python-version: 3.9.9
- run: pip install mypy
- run: mypy your_path In the example above you control everything. Python version, extra deps and how to install them, mypy version, its config, security, caching, even custom reporters like https://github.com/reviewdog/
Do others share my concerns? |
+1
I can follow up with a test.
It uses
Realistically, you almost always also want to install your dependencies and run
It's subjective, of course, but a Lastly, this action is modeled after black's, so there's precedent. |
Define a Github Action that can be used as a canonical way of running mypy as part of Github CI workflows as easy as: ``` jobs: lint: runs-on: ubuntu-latest steps: - uses: python/mypy ``` The action is inspired by its equivalent in black and supports the following options: ``` with: options: "..." # mypy command-line options paths: "." # a list of paths to check version: "0.910" # mypy version to use install_types: yes|no # whether to auto-install stubs ```
This was broken by python#11320 Co-authored-by: hauntsaninja <>
Define a Github Action that can be used as a canonical way of running mypy as part of Github CI workflows as easy as:
The action is inspired by its equivalent in black and supports the following options:
Example run