"--install-types not supported in this mode of running mypy" even with `--non-interactive`
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 20.6k
- Forks
- 3.3k
- PR merge metrics
- PR metrics pending
Description
Bug Report
When running mypy with redirected stdout / stderr (for example, via mypy.api.run), --install-types fails with:
error: --install-types not supported in this mode of running mypy
Per the comment, this is because --install-types performs user input. However, when --non-interactive is specified, no user input is necessary, and this error should not be raised.
To Reproduce
- Create a file
src/foo.pylike:
# src/foo.py
from mypy.api import run
_, _, exit_code = run(["--install-types", "--non-interactive", "src"])
assert exit_code == 0
- Run
python src/foo.py
Expected Behavior
The program exits with exit code 0.
Actual Behavior
Traceback (most recent call last):
File "src/foo.py", line 4, in <module>
assert exit_code == 0
AssertionError
Your Environment
- Mypy version used: 0.910
- Mypy command-line flags:
--install-types --non-interactive src(invoked via api) - Mypy configuration options from
mypy.ini(and other config files): N/A - Python version used: Python 3.7.5
- Operating system and version: Ubuntu 18.04.5 LTS (Bionic Beaver)
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by inspecting the --install-types mode check in mypy/main.py and reproduce the failure through mypy.api.run using --non-interactive. Done means this invocation no longer reports that the mode is unsupported and exits with code 0.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 55/100