Skip to content

Commit b99622b

Browse files
committed
Closes #36
1 parent 478562c commit b99622b

File tree

5 files changed

+16
-9
lines changed

5 files changed

+16
-9
lines changed

.pre-commit-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# See https://pre-commit.com/hooks.html for more hooks
33
repos:
44
- repo: https://github.com/psf/black
5-
rev: 21.6b0
5+
rev: 22.3.0
66
hooks:
77
- id: black
88
- repo: https://github.com/Lucas-C/pre-commit-hooks-markup

pylsp_mypy/_version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
__version__ = "0.5.8"
1+
__version__ = "0.6.0"

pylsp_mypy/plugin.py

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,14 @@
4242
# https://github.com/python-lsp/python-lsp-server/blob/v1.0.1/pylsp/plugins/pylint_lint.py#L55-L62
4343
last_diagnostics: Dict[str, List[Dict[str, Any]]] = collections.defaultdict(list)
4444

45+
# Windows started opening opening a cmd-like window for every subprocess call
46+
# This flag prevents that.
47+
# This flag is new in python 3.7
48+
# THis flag only exists on Windows
49+
windows_flag: Dict[str, int] = (
50+
{"startupinfo": subprocess.CREATE_NO_WINDOW} if os.name == "nt" else {} # type: ignore
51+
)
52+
4553

4654
def parse_line(line: str, document: Optional[Document] = None) -> Optional[Dict[str, Any]]:
4755
"""
@@ -214,7 +222,7 @@ def pylsp_lint(
214222
# -> use mypy on path
215223
log.info("executing mypy args = %s on path", args)
216224
completed_process = subprocess.run(
217-
["mypy", *args], stdout=subprocess.PIPE, stderr=subprocess.PIPE
225+
["mypy", *args], stdout=subprocess.PIPE, stderr=subprocess.PIPE, **windows_flag
218226
)
219227
report = completed_process.stdout.decode()
220228
errors = completed_process.stderr.decode()
@@ -234,15 +242,15 @@ def pylsp_lint(
234242
# dmypy exists on path
235243
# -> use mypy on path
236244
completed_process = subprocess.run(
237-
["dmypy", *apply_overrides(args, overrides)], stderr=subprocess.PIPE
245+
["dmypy", *apply_overrides(args, overrides)], stderr=subprocess.PIPE, **windows_flag
238246
)
239247
_err = completed_process.stderr.decode()
240248
_status = completed_process.returncode
241249
if _status != 0:
242250
log.info(
243251
"restarting dmypy from status: %s message: %s via path", _status, _err.strip()
244252
)
245-
subprocess.run(["dmypy", "kill"])
253+
subprocess.run(["dmypy", "kill"], **windows_flag)
246254
else:
247255
# dmypy does not exist on path, but must exist in the env pylsp-mypy is installed in
248256
# -> use dmypy via api
@@ -261,7 +269,7 @@ def pylsp_lint(
261269
# -> use mypy on path
262270
log.info("dmypy run args = %s via path", args)
263271
completed_process = subprocess.run(
264-
["dmypy", *args], stdout=subprocess.PIPE, stderr=subprocess.PIPE
272+
["dmypy", *args], stdout=subprocess.PIPE, stderr=subprocess.PIPE, **windows_flag
265273
)
266274
report = completed_process.stdout.decode()
267275
errors = completed_process.stderr.decode()

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ live_mode = true
2323
strict = true
2424

2525
[tool.mypy]
26-
python_version = "3.6"
26+
python_version = "3.7"
2727

2828
[[tool.mypy.overrides]]
2929
module = "pylsp.*"

setup.cfg

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,13 @@ classifiers =
1010
Intended Audience :: Developers
1111
Topic :: Software Development
1212
License :: OSI Approved :: MIT License
13-
Programming Language :: Python :: 3.6
1413
Programming Language :: Python :: 3.7
1514
Programming Language :: Python :: 3.8
1615
Programming Language :: Python :: 3.9
1716
Programming Language :: Python :: 3.10
1817

1918
[options]
20-
python_requires = >= 3.6
19+
python_requires = >= 3.7
2120
packages = find:
2221
install_requires =
2322
python-lsp-server

0 commit comments

Comments
 (0)