From d7a03981c1ceddf5d4bd6c777f61b264c8d750a3 Mon Sep 17 00:00:00 2001 From: Martin Weinelt Date: Thu, 21 May 2026 15:02:11 +0200 Subject: [PATCH 1/2] python3Packages.python-lsp-server: fix test with jedi 0.20.0 --- .../python-lsp-server/default.nix | 6 +++ .../python-lsp-server/jedi-compat.patch | 40 +++++++++++++++++++ 2 files changed, 46 insertions(+) create mode 100644 pkgs/development/python-modules/python-lsp-server/jedi-compat.patch diff --git a/pkgs/development/python-modules/python-lsp-server/default.nix b/pkgs/development/python-modules/python-lsp-server/default.nix index 7d4f27a018f0..45b86c74ddcf 100644 --- a/pkgs/development/python-modules/python-lsp-server/default.nix +++ b/pkgs/development/python-modules/python-lsp-server/default.nix @@ -53,9 +53,15 @@ buildPythonPackage rec { hash = "sha256-Yq5dYaX+/hLvmPpHI8rhCcSlabQBPAyUrIQRgnoi17c="; }; + patches = [ + # https://github.com/python-lsp/python-lsp-server/pull/709 + ./jedi-compat.patch + ]; + pythonRelaxDeps = [ "autopep8" "flake8" + "jedi" "mccabe" "pycodestyle" "pydocstyle" diff --git a/pkgs/development/python-modules/python-lsp-server/jedi-compat.patch b/pkgs/development/python-modules/python-lsp-server/jedi-compat.patch new file mode 100644 index 000000000000..549ab1846317 --- /dev/null +++ b/pkgs/development/python-modules/python-lsp-server/jedi-compat.patch @@ -0,0 +1,40 @@ +From 07bb69fe0c3168f9951914547dcb89309fea1b20 Mon Sep 17 00:00:00 2001 +From: Lumir Balhar +Date: Mon, 4 May 2026 12:09:22 +0200 +Subject: [PATCH] Fix test_snippets_completion to not depend on typeshed + overload ordering + +jedi 0.20.0 bundles a newer typeshed that adds a no-arg overload for +defaultdict.__init__ as the first overload, causing format_snippet to +hit the zero-params branch and produce "defaultdict()" instead of +"defaultdict($0)". Replace defaultdict with a locally-defined function +to make the test stable across typeshed updates. +--- + test/plugins/test_completion.py | 6 +++--- + 1 file changed, 3 insertions(+), 3 deletions(-) + +diff --git a/test/plugins/test_completion.py b/test/plugins/test_completion.py +index ae5021f5..bbaeabe0 100644 +--- a/test/plugins/test_completion.py ++++ b/test/plugins/test_completion.py +@@ -322,7 +322,7 @@ def test_matplotlib_completions(config, workspace) -> None: + + + def test_snippets_completion(config, workspace) -> None: +- doc_snippets = "from collections import defaultdict \na=defaultdict" ++ doc_snippets = "from collections import defaultdict \ndef foo(a): pass\nfoo" + com_position = {"line": 0, "character": 35} + doc = Document(DOC_URI, workspace, doc_snippets) + config.capabilities["textDocument"] = { +@@ -332,9 +332,9 @@ def test_snippets_completion(config, workspace) -> None: + completions = pylsp_jedi_completions(config, doc, com_position) + assert completions[0]["insertText"] == "defaultdict" + +- com_position = {"line": 1, "character": len(doc_snippets)} ++ com_position = {"line": 2, "character": 3} + completions = pylsp_jedi_completions(config, doc, com_position) +- assert completions[0]["insertText"] == "defaultdict($0)" ++ assert completions[0]["insertText"] == "foo($0)" + assert completions[0]["insertTextFormat"] == lsp.InsertTextFormat.Snippet + + From 2aba8c3e0989d90074742064a1f8e775d5e64109 Mon Sep 17 00:00:00 2001 From: Martin Weinelt Date: Thu, 21 May 2026 15:32:46 +0200 Subject: [PATCH 2/2] spyder: relax jedi constraint --- pkgs/development/python-modules/spyder/default.nix | 1 + 1 file changed, 1 insertion(+) diff --git a/pkgs/development/python-modules/spyder/default.nix b/pkgs/development/python-modules/spyder/default.nix index 7e0a1ecba5d3..dcfda2d4e559 100644 --- a/pkgs/development/python-modules/spyder/default.nix +++ b/pkgs/development/python-modules/spyder/default.nix @@ -77,6 +77,7 @@ buildPythonPackage rec { pythonRelaxDeps = [ "ipython" + "jedi" "python-lsp-server" ];