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

python 3.10 in CI, mypy checks files in site-packages #13882

Closed
copdips opened this issue Oct 13, 2022 · 7 comments
Closed

python 3.10 in CI, mypy checks files in site-packages #13882

copdips opened this issue Oct 13, 2022 · 7 comments
Labels
bug mypy got something wrong

Comments

@copdips
Copy link

copdips commented Oct 13, 2022

Bug Report

Hello,
I'm using Azure pipeline agent with python 3.10. with latest mypy version triggered by pre-commit, with pyproject.toml config file.
I installed all the python packages without venv, as it's a CI agent.
During the pre-commit check, it throws mypy error on:

/opt/hostedtoolcache/Python/3.10.7/x64/lib/python3.10/site-packages/pandas-stubs/core/series.pyi:314: error: Positional-only parameters are only supported in Python 3.8 and greater  [syntax]

For Azure pipeline agent with python 3.8 and 3.9, there's no such error.

And I also tried multiple options to exclude the file by pattern site-packages in the config file pyproject.toml as per this doc, none of them works, except for ".py" or '.py', but it disables the check at all.
Could anybody provide the correct the exclude syntax in pyproject.toml to exclude files by path keyword, where in my case is /site-packages/

To Reproduce

See above bug report section

Expected Behavior

No cheks for files in site-packages

Actual Behavior

Mypy checks files in python packages

Your Environment

  • Mypy version used: 0.961
  • Mypy command-line flags:
  • Mypy configuration options from mypy.ini (and other config files):
  • Python version used: Python3.10.7
# file pyproject.toml
[tool.mypy]
ignore_missing_imports = true
warn_return_any = true
warn_unused_configs = true
# file .pre-commit-config.yaml
- repos:
  - repo: local
    hooks:
      - id: mypy
        name: mypy
        language: system
        entry: mypy
        types: [python]
        args:
          - --show-error-codes
@copdips copdips added the bug mypy got something wrong label Oct 13, 2022
@copdips copdips changed the title python 3.10 in CI, mypy checks pyi files in site-package python 3.10 in CI, mypy checks files in site-packages Oct 13, 2022
@hauntsaninja
Copy link
Collaborator

Upgrade to mypy 0.982 or downgrade to Python 3.10.6 #13627

@copdips
Copy link
Author

copdips commented Oct 13, 2022

@hauntsaninja
I tried to pin mypy==0.982, but Python3.10.7 cannot pip install it, the lastest version found is 0.961
Whereas with python 3.8 and 3.9, it can install 0.982 with the same pypi index as Python 3.10.7.
Is there any limitation that we cannot install 0.982 with Python 3.10.7 ?

BTW, with Azure pipeline, we can only chose the major and minor version of Python, not the patch version, so, 3.8, 3.9, 3.10 etc.
And in my case, we need to check under Python 3.10, the only python 3.10 provided by Azure pipeline is 3.10.7

(after test I can use 3.10.6 in Azure pipeline)

@hauntsaninja
Copy link
Collaborator

No, there's no such limitation, see https://pypi.org/project/mypy/0.982/#files

@AlexWaygood
Copy link
Member

I've been able to pip install mypy==0.982 fine on Python 3.10.7 FWIW

@copdips
Copy link
Author

copdips commented Oct 13, 2022

indeed, I'm using Azure artifact pypi, it cannot find mypy==0.982 for Python 3.10 but when I switched to public pypi index, it works. But with Azure artifact pypi it can find 0.982 for other Python versions.
it's must be an internal issue from Azure or my side..

@hauntsaninja
Copy link
Collaborator

I sometimes have to deal with Azure artifacts at work too and it sucks :-) Best of luck!

@copdips
Copy link
Author

copdips commented Oct 13, 2022

Thx, I just fired a case to Azure :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug mypy got something wrong
Projects
None yet
Development

No branches or pull requests

3 participants