matangover / mypyls

Mypy language server: runs mypy on Python code to provide type checking, go to definition, and hover.
MIT License
34 stars 5 forks source link

The mypy server crashed 5 times in the last 3 minutes. The server will not be restarted. #9

Open adam-grant-hendry opened 3 years ago

adam-grant-hendry commented 3 years ago

I get the following error every time I start up VSCode:

The mypy server crashed 5 times in the last 3 minutes. The server will not be restarted.

I created a python 3.8 venv and started a project with poetry. I am using the default Microsoft Python language server in VSCode. I have the following setup:

settings.json

"mypy.configFile": "${workspaceFolder}\\mypi.ini",
"mypy.executable": "${workspaceFolder}\\.venv\\Scripts\\mypy.exe",
"mypy.targets": [
    ".",
    "${workspaceFolder}"
],
"python.linting.mypyEnabled": true,
"python.linting.mypyPath": "${workspaceFolder}\\.venv\\Scripts\\mypy.exe",

mypy.ini

[mypy]
python_version = 3.8
warn_return_any = True
warn_unused_configs = True

[mypy-bs4.*]
ignore_missing_imports = True

pyproject.toml

[tool.poetry]
name = "type_hinting_demo"
version = "0.1.0"
description = "A type hinting demo."
authors = ["Adam Hendry <adam.grant.hendry@gmail.com>"]
license = "Apache-2.0"
packages = [
    {include = "type_hinting_demo"},
    {include = "docs"},
    {include = "tests"}
]

[tool.poetry.dependencies]
python = "^3.8"
sphinx-rtd-theme = "^0.5.1"

[tool.poetry.dev-dependencies]
black = "^20.8b1"
bump2version = "^1.0.1"
pylint = "^2.7.0"
ipython = "^7.20.0"
isort = "^5.7.0"
docformatter = "^1.4"
pytest = "^6.2.2"
pytest-cov = "^2.11.1"
pytest-randomly = "^3.5.0"
pytest-bdd = "^4.0.2"
coverage = "^5.4"
bandit = "^1.7.0"
pytest-sphinx = "^0.3.1"
bs4 = "^0.0.1"
lxml = "^4.6.2"
html5lib = "^1.1"
requests = "^2.25.1"
coverage-badge = "^1.0.1"
pytest-mypy = "^0.8.0"
mypy = "^0.812"
flake8 = "^3.8.4"

[build-system]
requires = ["poetry-core>=1.0.0"]
build-backend = "poetry.core.masonry.api"

The output of the mypy extension is the following:

usage: mypy [-h] [-v] [-V] [more options; see below]
            [-m MODULE] [-p PACKAGE] [-c PROGRAM_TEXT] [files ...]
mypy: error: Missing target module, package, files, or command.
[Info  - 5:05:00 PM] Connection to server got closed. Server will restart.
usage: mypy [-h] [-v] [-V] [more options; see below]
            [-m MODULE] [-p PACKAGE] [-c PROGRAM_TEXT] [files ...]
mypy: error: Missing target module, package, files, or command.
[Info  - 5:05:01 PM] Connection to server got closed. Server will restart.
usage: mypy [-h] [-v] [-V] [more options; see below]
            [-m MODULE] [-p PACKAGE] [-c PROGRAM_TEXT] [files ...]
mypy: error: Missing target module, package, files, or command.
[Info  - 5:05:02 PM] Connection to server got closed. Server will restart.
usage: mypy [-h] [-v] [-V] [more options; see below]
            [-m MODULE] [-p PACKAGE] [-c PROGRAM_TEXT] [files ...]
mypy: error: Missing target module, package, files, or command.
[Info  - 5:05:03 PM] Connection to server got closed. Server will restart.
usage: mypy [-h] [-v] [-V] [more options; see below]
            [-m MODULE] [-p PACKAGE] [-c PROGRAM_TEXT] [files ...]
mypy: error: Missing target module, package, files, or command.
[Error - 5:05:03 PM] Connection to server got closed. Server will not be restarted.
matangover commented 3 years ago

Not quite sure what is causing mypy to crash. Can you try changing mypy.targets to just .? You have also ${workspaceFolder} in there, delete that.

matangover commented 3 years ago

Hi @adam-grant-hendry, is the issue still relevant?