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

Github actions mypy build check fails when python 3.9 typing is used #66

Closed
jacobcook1995 opened this issue Aug 26, 2022 · 3 comments · Fixed by #67
Closed

Github actions mypy build check fails when python 3.9 typing is used #66

jacobcook1995 opened this issue Aug 26, 2022 · 3 comments · Fixed by #67
Labels
bug Something isn't working

Comments

@jacobcook1995
Copy link
Collaborator

Describe the bug
When the inbuilt type notation introduced in python 3.9 (e.g. list[str]) is used, the pre-commit/action@v2.0.2 fails the mypy build check. This is despite it passing the pre-commit hook locally.

To Reproduce
Steps to reproduce the behavior:

  1. Add a type hint which indexes a collection type (e.g. list[str] or tuple[int]) to existing code
  2. Commit this code
  3. If it passes the pre-commit hooks push the code
  4. The GitHub actions build check should fail with a message similar to error: "list" is not subscriptable, use "typing.List" instead

Expected behavior
The mypy build check should pass as we have set our supported python to be >=3.9.

Desktop (please complete the following information):

  • OS: macOS
  • Version 12.5.1
@jacobcook1995 jacobcook1995 added the bug Something isn't working label Aug 26, 2022
@davidorme
Copy link
Collaborator

I think we just need to add a python-version section to the qa job

@davidorme
Copy link
Collaborator

Yeah - the ubuntu-latest is Ubuntu 20.04, which includes Python 3.8, so that is what is being used:

https://wiki.ubuntu.com/FocalFossa/ReleaseNotes#:~:text=In%2020.04%20LTS%2C%20the%20python,base%20system%20is%20Python%203.8.

@davidorme
Copy link
Collaborator

OK, so I think we'll just need to add an extra step:

    - uses: actions/setup-python@v4
      with:
        python-version: "3.9"

I think it makes sense to just use the lowest version we want to support.

@jacobcook1995 jacobcook1995 mentioned this issue Aug 26, 2022
7 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants