From cd18e22b054a7d71b81740b0c98e026c2190553b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20R=C3=B6thlisberger?= Date: Mon, 27 Nov 2023 12:43:57 +0000 Subject: [PATCH 1/2] Update VSCode linting settings `python.linting.*` settings have been deprecated and split up into separate extensions; you should use the individual extensions' settings instead. https://github.com/microsoft/vscode-python/wiki/Migration-to-Python-Tools-Extensions --- stbt_rig.py | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/stbt_rig.py b/stbt_rig.py index e0021da..7f852d5 100755 --- a/stbt_rig.py +++ b/stbt_rig.py @@ -905,12 +905,9 @@ def _update_vscode_config(): "git.fetchOnPull": True, "git.pruneOnFetch": True, "git.pullBeforeCheckout": True, + "pylint.args": ["--load-plugins=_stbt.pylint_plugin"], "python.envFile": "${workspaceFolder}/.env", - "python.linting.enabled": True, - "python.linting.mypyEnabled": False, "python.testing.nosetestsEnabled": False, - "python.linting.pylintArgs": ["--load-plugins=_stbt.pylint_plugin"], - "python.linting.pylintEnabled": True, "python.testing.pytestArgs": [ "-p", "stbt_rig", "-p", "no:python", @@ -934,6 +931,13 @@ def _update_vscode_config(): } ] } + DEPRECATED_KEYS = { + "python.linting.enabled", + "python.linting.mypyEnabled", + "python.linting.pylintArgs", + "python.linting.pylintEnabled", + } + try: with open(".vscode/settings.json") as f: cfg = json.load(f) @@ -945,6 +949,10 @@ def _update_vscode_config(): if cfg.get(k) != v: cfg[k] = v modified = True + for k in list(cfg.keys()): + if k in DEPRECATED_KEYS: + del cfg[k] + modified = True if modified: mkdir_p(".vscode") From 33f288e98caf66667cc2297e7a30d5aba79f2c0b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20R=C3=B6thlisberger?= Date: Mon, 27 Nov 2023 13:26:14 +0000 Subject: [PATCH 2/2] vscode: Use pylint binary from venv So that we control the pylint & astroid version, for consistent results. This forces the extension to shell out to pylint. Without this, the extension tries to import pylint instead of running it as a subprocess, and if we use "pylint.importStrategy: fromEnvironment" to import our version of pylint, that causes all sorts of compatibility issues because the extension's dependencies (like `attrs`) come from our venv instead of the extension. --- stbt_rig.py | 1 + 1 file changed, 1 insertion(+) diff --git a/stbt_rig.py b/stbt_rig.py index 7f852d5..1d1922e 100755 --- a/stbt_rig.py +++ b/stbt_rig.py @@ -906,6 +906,7 @@ def _update_vscode_config(): "git.pruneOnFetch": True, "git.pullBeforeCheckout": True, "pylint.args": ["--load-plugins=_stbt.pylint_plugin"], + "pylint.path": ["pylint"], "python.envFile": "${workspaceFolder}/.env", "python.testing.nosetestsEnabled": False, "python.testing.pytestArgs": [