pythonversionmypypython-poetrygitpod

MyPy using other Pyhton version as in venv? (Positional-only parameters are only supported in Python 3.8 and greater)


MyPy thinks it has to check for Python <3.8 when instead it should use 3.10

As you can see, Python3.10 is active

(myvenv) gitpod /workspace/myfolder (mybranch) $ python --version
Python 3.10.7

however mypy think its <3.8?

(myvenv) gitpod /workspace/myfolder (mybranch) $ mypy -p my_folder_with_code
/workspace/.pyenv_mirror/poetry/virtualenvs/myenv/lib/python3.10/site-packages/numpy/__init__.pyi:641:
error: Positional-only parameters are only supported in Python 3.8 and greater
Found 1 error in 1 file (errors prevented further checking)

even mypy --python-version 3.10 -p my_folder_with_code produces the same error

This happens only in this platform (gitpod). On other devices it runs fine (so no error in code)

I googled around but did found what i'm looking for... can somebody help?


Solution

  • Ok, i found it out miself. Apparently it was a bug in mypy.

    Update MyPy and it works again
    pip install -U mypy
    Or in my case
    poetry update mypy