tsuyoshicho / action-mypy

Run mypy with reviewdog on pull requests to improve code writing experience.
Creative Commons Zero v1.0 Universal
20 stars 8 forks source link

Suggestion: Allow user to choose mypy version manually #94

Closed abelcheung closed 1 year ago

abelcheung commented 1 year ago

Sometimes people may not want to use the latest mypy for testing, because mypy can change its type checking output format (for example, Tuple[...] is changed to tuple[...] in 1.4, and Union[a, b] becomes a | b) . People who run automatic test suite would want to pin to a very specific mypy version.

Indeed, it is possible to pin to a specific action-mypy commit in GitHub workflow instead, but that also means people are unable to use any new features in latest action-mypy.

To be concise, I mean something like:

- name: workflow name
  uses: tsuyoshicho/action-mypy@v3
  with:
    mypy_version: '1.2.0'
tsuyoshicho commented 1 year ago

Hi @abelcheung , Thank you for your suggestion.


I understand your suggestion.

However, I would like to hold off because the effect is limited.

The reasons are as follows.


We will support it in the next major version https://github.com/tsuyoshicho/action-mypy/issues/70

PR is welcome.

tsuyoshicho commented 1 year ago

Note:

Now you can specify the version directly in setup_command.

abelcheung commented 1 year ago
* Essentially, you should have your own requirements.txt for your environment and set it up yourself
* If you want to use a fixed version of mypy, you need to fix it yourself and use the same one on local and on CI, otherwise you are likely to have problems

Yes, these 2 are the exact reason why I want to see action-mypy allowing users to specify mypy version. In a CI workflow all tools need some way to set tools versions.

Many python related tools use requirements.txt or pyproject.toml, tox has its own tox.ini to achieve the same effect, and so on. But I originally thought action-mypy doesn't have any.

You have pointed me to setup_command and it can achieve the same result, so I guess my suggestion can be closed, thanks a lot!