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

Disappearing dmypy errors using --export-types, pip install -e, and absolute paths #16768

Open
meshy opened this issue Jan 11, 2024 · 1 comment
Labels
bug mypy got something wrong topic-daemon dmypy

Comments

@meshy
Copy link
Contributor

meshy commented Jan 11, 2024

Bug Report

Errors disappear on the second run of dmypy under specific circumstances:

  • Dmypy is run using the --export-types flag.
  • We use absolute paths to the files checked.
  • The files checked are in a project which has been installed with pip install -e.
  • The files checked are in a src directory. (This is so odd that I feel as though I might have made a mistake here.)

This looks similar to #9655, but unlike that, this isn't fixed by #15043 (see #15043 (comment)).

To Reproduce

The best minimal example I have so far:

pyproject.toml:

[build-system]
requires = ["setuptools >= 64"]
build-backend = "setuptools.build_meta"

[project]
name = "dmypy_example"
version = "0.0.1"
dependencies = []

src/foo.py:

a: str = 1

Commands:

# Create a new Python 3.12 virtualenv, then:
pip install --editable .
dmypy run --export-types $(pwd)/src/foo.py
dmypy run --export-types $(pwd)/src/foo.py

Expected Behavior

We should see the same error output after both runs of dmypy.

Actual Behavior

Regardless of the error in the file, it disappears on the second run of dmypy.

$ pip install --editable .
...

$ dmypy run --export-types $(pwd)/src/foo.py
Daemon started
src/foo.py:1: error: Incompatible types in assignment (expression has type "int", variable has type "str")  [assignment]
Found 1 error in 1 file (checked 1 source file)

$ dmypy run --export-types $(pwd)/src/foo.py
Success: no issues found in 1 source file

Your Environment

  • Mypy configuration options from mypy.ini (and other config files): None.
  • Python version used: 3.12.
@ezyang
Copy link

ezyang commented Jan 27, 2024

We're affected by this too!

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

No branches or pull requests

3 participants