tsuyoshicho / action-mypy

Run mypy with reviewdog on pull requests to improve code writing experience.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Custom MyPy binary

jonathanberthias opened this issue · comments

When installing dependencies with Poetry, the mypy ... command is not available and instead one should use poetry run mypy ....

It would be nice to be able to add an option for the binary used for the mypy invocation (and potentially an option to skip installing mypy without checking if it is installed).

I will consider responding this issue.

@jonathanberthias san,

Fix action-mypy for using "Poetry".
https://github.com/tsuyoshicho/action-mypy/tree/feature/adaptivesetup

Could you please test this branch?

      - uses: tsuyoshicho/action-mypy@feature/adaptivesetup
        with:
          # your settings
          # ...
          # Poetry support
          execute_command: 'poetry run mypy'
          setup_method: 'nothing'

(Also check the README.)

@tsuyoshicho

Thanks for being so quick to reply!

I just tested the branch, and it works exactly as expected! Actually, I didn't need the setup_method change since the poetry run mypy --version command succeeds, and installation is skipped even with the "adaptive" method.

Also, FYI, I can't run poetry shell in GitHub workflows:

Run poetry shell
Spawning shell within /home/runner/work/test-stuff/test-stuff/.venv

(25, 'Inappropriate ioctl for device')
Error: Process completed with exit code 1.

that's why I have to run poetry run mypy explicitly.

Hi, @jonathanberthias,

Thanks for the report.

I have added setup_method for future use.
I presented the setup for safety, but I'm glad it works with adaptive as well.

I did not know that the poetry shell did not work in Github workflow.
Thanks for letting me know.

I will release it in a minor VerUp.

Regard.
Cho