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

handling of exclude configuration changed in an incompatible way in 0.930 #11830

Closed
asottile opened this issue Dec 23, 2021 · 4 comments · Fixed by #11881
Closed

handling of exclude configuration changed in an incompatible way in 0.930 #11830

asottile opened this issue Dec 23, 2021 · 4 comments · Fixed by #11881
Labels
bug mypy got something wrong

Comments

@asottile
Copy link
Contributor

asottile commented Dec 23, 2021

#11825 seems related but slightly different as that one causes a crash -- I believe this was broken in #11329

Bug Report

for example: (this is reduced from a larger example just to demonstrate a minimal example)

# mypy.ini
[mypy]
exclude=(?x)
    ^(
        setup\.py$
    )

To Reproduce

set up a configuration above and run mypy

Expected Behavior

in mypy 0.920 this excluded all setup.py files

Actual Behavior

this appears to exclude all files:

$ mypy .
There are no .py[i] files in directory '.'

Your Environment

  • Mypy version used: 0.930
  • Mypy command-line flags: (see above)
  • Mypy configuration options from mypy.ini (and other config files): (see above)
  • Python version used: 3.8.10
  • Operating system and version: ubuntu 20.04
@asottile asottile added the bug mypy got something wrong label Dec 23, 2021
@hauntsaninja
Copy link
Collaborator

cc @nipunn1313 something like #11828 should work for pyproject.toml, but curious for your opinion on what this should look like going forward for ini files

@nipunn1313
Copy link
Contributor

Great question.

I think the safest option is to maintain the old behavior on .ini files - such that you cannot provide multiple --exclude inside ini files. ini files don't have support for array structures so this seems ok.

There is a simple workaround to get access to the new feature - using pyproject.toml instead of mypy.ini.

@posita
Copy link
Contributor

posita commented Jan 1, 2022

I can try to augment #11828 (or provide a PR that depends on it) to restore the old .ini behavior. Would that work?

posita added a commit to posita/mypy that referenced this issue Jan 1, 2022
posita added a commit to posita/mypy that referenced this issue Jan 1, 2022
posita added a commit to posita/mypy that referenced this issue Jan 1, 2022
Partially reverts python#11329 (with respect to `.ini` documentation).
Modifies existing unit tests.

Fixes python#11830.
@posita
Copy link
Contributor

posita commented Jan 1, 2022

I added #11881 to address #11830 by reverting to treating exclude in mypy.ini as a single string. This should be compatible with #11828.

JukkaL pushed a commit that referenced this issue Jan 4, 2022
Partially reverts #11329 (with respect to `.ini` documentation).
Modifies existing unit tests.

Fixes #11830.

Co-authored-by: Matthew W <matthew@willcockson.family>
JukkaL pushed a commit that referenced this issue Jan 5, 2022
Partially reverts #11329 (with respect to `.ini` documentation).
Modifies existing unit tests.

Fixes #11830.

Co-authored-by: Matthew W <matthew@willcockson.family>
tushar-deepsource pushed a commit to DeepSourceCorp/mypy that referenced this issue Jan 20, 2022
Partially reverts python#11329 (with respect to `.ini` documentation).
Modifies existing unit tests.

Fixes python#11830.

Co-authored-by: Matthew W <matthew@willcockson.family>
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

Successfully merging a pull request may close this issue.

4 participants