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

mypy output for submodule differs between invoking on package vs submodule #10956

Closed
sanderr opened this issue Aug 9, 2021 · 1 comment
Closed
Labels
bug mypy got something wrong

Comments

@sanderr
Copy link

sanderr commented Aug 9, 2021

Bug Report

Running mypy against a whole package doesn't always give the same output for one of its modules as running it against that module directly. Specifically some errors are omitted when run against the whole package. #10260 seems to describe a related discrepancy, though the behavior there is more or less the opposite to this one (additionally, it is for a version of mypy that doesn't produce this issue).

To Reproduce

Alas I didn't manage to find a simple reproductive example. Instead I'll have to refer to the project where I encountered the issue.

  1. Clone the repo: git clone https://github.com/inmanta/inmanta-core.git
  2. Check out a commit on which the issue exists cd inmanta-core && git checkout a49f051a
  3. Create and activate a virtual env
  4. Install the project in the venv: make install
  5. Run mypy src/inmanta/ | grep "src/inmanta/module.py" and compare the output with mypy src/inmanta/module.py.

Expected Behavior

The src/inmanta/module.py file contains type errors, as shown by mypy src/inmanta/module.py. I would expect to see the same errors for the same file, regardless of how it was invoked. Specifically, in this case I would expect mypy src/inmanta/ to detect and report on all type errors in src/inmanta/module.py.

Actual Behavior

The output of mypy src/inmanta/ only shows a subset of the errors for src/inmanta/module.py that are shown in mypy src/inmanta/module.py.

Your Environment

  • Mypy version used: v0.900 - v0.910 (v0.812 works as expected)
  • Mypy command-line flags: mypy src/inmanta / mypy src/inmanta/module.py
  • Mypy configuration options from mypy.ini (and other config files): in setup.cfg:
    [mypy]
    plugins = pydantic.mypy
    
  • Python version used: 3.9 and 3.6
  • Operating system and version: Arch Linux
@sanderr sanderr added the bug mypy got something wrong label Aug 9, 2021
@sanderr
Copy link
Author

sanderr commented Feb 21, 2022

Apparently this was introduced in #10579. Adding --soft-error-limit=-1 resolves the issue.

@sanderr sanderr closed this as completed Feb 21, 2022
inmantaci pushed a commit to inmanta/inmanta-core that referenced this issue Feb 21, 2022
# Description

Fixes python/mypy#10956

Thanks @bartv

# Self Check:

Strike through any lines that are not applicable (`~~line~~`) then check the box

- [ ] Attached issue to pull request
- [ ] Changelog entry
- [ ] Type annotations are present
- [ ] Code is clear and sufficiently documented
- [ ] No (preventable) type errors (check using make mypy or make mypy-diff)
- [ ] Sufficient test cases (reproduces the bug/tests the requested feature)
- [ ] Correct, in line with design
- [ ] End user documentation is included or an issue is created for end-user documentation (add ref to issue here: )

# Reviewer Checklist:

- [ ] Sufficient test cases (reproduces the bug/tests the requested feature)
- [ ] Code is clear and sufficiently documented
- [ ] Correct, in line with design
inmantaci pushed a commit to inmanta/inmanta-core that referenced this issue Feb 21, 2022
# Description

Fixes python/mypy#10956

Thanks @bartv

# Self Check:

Strike through any lines that are not applicable (`~~line~~`) then check the box

- [ ] Attached issue to pull request
- [ ] Changelog entry
- [ ] Type annotations are present
- [ ] Code is clear and sufficiently documented
- [ ] No (preventable) type errors (check using make mypy or make mypy-diff)
- [ ] Sufficient test cases (reproduces the bug/tests the requested feature)
- [ ] Correct, in line with design
- [ ] End user documentation is included or an issue is created for end-user documentation (add ref to issue here: )

# Reviewer Checklist:

- [ ] Sufficient test cases (reproduces the bug/tests the requested feature)
- [ ] Code is clear and sufficiently documented
- [ ] Correct, in line with design
inmantaci pushed a commit to inmanta/inmanta-core that referenced this issue Feb 21, 2022
# Description

Fixes python/mypy#10956

Thanks @bartv

# Self Check:

Strike through any lines that are not applicable (`~~line~~`) then check the box

- [ ] Attached issue to pull request
- [ ] Changelog entry
- [ ] Type annotations are present
- [ ] Code is clear and sufficiently documented
- [ ] No (preventable) type errors (check using make mypy or make mypy-diff)
- [ ] Sufficient test cases (reproduces the bug/tests the requested feature)
- [ ] Correct, in line with design
- [ ] End user documentation is included or an issue is created for end-user documentation (add ref to issue here: )

# Reviewer Checklist:

- [ ] Sufficient test cases (reproduces the bug/tests the requested feature)
- [ ] Code is clear and sufficiently documented
- [ ] Correct, in line with design
sanderr added a commit to inmanta/inmanta-core that referenced this issue Feb 22, 2022
# Description

Fixes python/mypy#10956

Thanks @bartv

# Self Check:

Strike through any lines that are not applicable (`~~line~~`) then check the box

- [ ] Attached issue to pull request
- [ ] Changelog entry
- [ ] Type annotations are present
- [ ] Code is clear and sufficiently documented
- [ ] No (preventable) type errors (check using make mypy or make mypy-diff)
- [ ] Sufficient test cases (reproduces the bug/tests the requested feature)
- [ ] Correct, in line with design
- [ ] End user documentation is included or an issue is created for end-user documentation (add ref to issue here: )

# Reviewer Checklist:

- [ ] Sufficient test cases (reproduces the bug/tests the requested feature)
- [ ] Code is clear and sufficiently documented
- [ ] Correct, in line with design
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.

1 participant