-
-
Notifications
You must be signed in to change notification settings - Fork 3k
Closed
Labels
Description
- Are you reporting a bug, or opening a feature request?
It's not a feature request. I'm pretty sure it's a bug, but it might be a bug in the form of incomplete documentation (i.e., this is an undocumented feature), or it might be part code bug part documentation bug. - Please insert below the code you are checking with mypy, or a mock-up repro if the source is private. We would appreciate if you try to simplify your case to a minimal repro.
Please see the open source project https://github.com/eventbrite/conformity. It has apy.typed
file and MyPy does successfully use that in other projects, but only in certain circumstances. - What is the actual behavior/output?
- Have
mypy
already installed in the system Python 3.7.mkvirtualenv
for a new project with Conformity in its dependencies and using Conformity types.pip install mypy
in the virtualenv, then install the project dependencies.mypy .
in the project works without any errors. - Have
mypy
already installed in the system Python 3.7.mkvirtualenv
for the same project. Install the project dependencies, thenpip install mypy
in the virtualenv, too.mypy .
in the project results in import errors about Conformity. - Have
mypy
already installed in the system Python 3.7.mkvirtualenv
for the same project. Install the project dependencies but do not installmypy
in the virtualenv.mypy .
in the project results in import errors about Conformity.
- Have
- What is the behavior/output you expect?
- The first scenario is what I expect. No errors.
- The second scenario should work like the first. No errors. It shouldn't matter whether you install
mypy
before or after you install the project dependencies (namely Conformity). It appears that, in this scenario, MyPy is using the system Python path instead of the virtualenv Python path, even thoughwhich mypy
is correct (see below). - I would hope that the third scenario could also be made to work, but I understand if it can't (different paths for the
mypy
command shebang vs. the virtualenvpython
). However, this isn't documented anywhere, so it should be.
- What are the versions of mypy and Python you are using? Do you see the same issue after installing mypy from Git master?
I have not tried installing Git from master because the problem is not version-dependent AFAICT. It is install-order dependent. I did, however, look for any other similar issues that had been addressed, or documentation that could help here, and found none.-
$ which python /Users/nwilliams/.virtualenvs/ebmetrics3/bin/python $ python --version Python 3.7.4 $ which mypy /Users/nwilliams/.virtualenvs/ebmetrics3/bin/mypy $ mypy --version mypy 0.720
-
$ which python /Users/nwilliams/.virtualenvs/ebmetrics3/bin/python $ python --version Python 3.7.4 $ which mypy /Users/nwilliams/.virtualenvs/ebmetrics3/bin/mypy $ mypy --version mypy 0.720
-
$ which python3 /usr/local/bin/python3 $ python3 --version Python 3.7.4 $ which mypy /usr/local/bin/mypy $ mypy --version mypy 0.701
-
- What are the mypy flags you are using? (For example --strict-optional)
[mypy] python_version = 3.7 check_untyped_defs = True [mypy-setup] ignore_errors = True [mypy-tasks] ignore_errors = True [mypy-django.*] ignore_missing_imports = True [mypy-pytest.*] ignore_missing_imports = True
- If mypy crashed with a traceback, please paste the full traceback below.
No crash.