1{
2 lib,
3 buildPythonPackage,
4 fetchFromGitHub,
5
6 # build-system
7 setuptools-scm,
8
9 # dependencies
10 black,
11 docstring-to-markdown,
12 jedi,
13 pluggy,
14 python-lsp-jsonrpc,
15 setuptools,
16 ujson,
17
18 # optional-dependencies
19 autopep8,
20 flake8,
21 mccabe,
22 pycodestyle,
23 pydocstyle,
24 pyflakes,
25 pylint,
26 rope,
27 toml,
28 whatthepatch,
29 yapf,
30
31 # tests
32 flaky,
33 matplotlib,
34 numpy,
35 pandas,
36 pytest-cov-stub,
37 pytestCheckHook,
38 websockets,
39 versionCheckHook,
40 writableTmpDirAsHomeHook,
41}:
42
43buildPythonPackage rec {
44 pname = "python-lsp-server";
45 version = "1.13.1";
46 pyproject = true;
47
48 src = fetchFromGitHub {
49 owner = "python-lsp";
50 repo = "python-lsp-server";
51 tag = "v${version}";
52 hash = "sha256-wxouTbqkieH3fxnXY0PIKDtDV97AbGWujisS2JmjBkE=";
53 };
54
55 pythonRelaxDeps = [
56 "autopep8"
57 "flake8"
58 "mccabe"
59 "pycodestyle"
60 "pydocstyle"
61 "pyflakes"
62 ];
63
64 build-system = [ setuptools-scm ];
65
66 dependencies = [
67 black
68 docstring-to-markdown
69 jedi
70 pluggy
71 python-lsp-jsonrpc
72 setuptools # `pkg_resources`imported in pylsp/config/config.py
73 ujson
74 ];
75
76 optional-dependencies = {
77 all = [
78 autopep8
79 flake8
80 mccabe
81 pycodestyle
82 pydocstyle
83 pyflakes
84 pylint
85 rope
86 toml
87 websockets
88 whatthepatch
89 yapf
90 ];
91 autopep8 = [ autopep8 ];
92 flake8 = [ flake8 ];
93 mccabe = [ mccabe ];
94 pycodestyle = [ pycodestyle ];
95 pydocstyle = [ pydocstyle ];
96 pyflakes = [ pyflakes ];
97 pylint = [ pylint ];
98 rope = [ rope ];
99 yapf = [
100 whatthepatch
101 yapf
102 ];
103 websockets = [ websockets ];
104 };
105
106 nativeCheckInputs = [
107 flaky
108 matplotlib
109 numpy
110 pandas
111 pytest-cov-stub
112 pytestCheckHook
113 versionCheckHook
114 writableTmpDirAsHomeHook
115 ]
116 ++ optional-dependencies.all;
117 versionCheckProgram = "${placeholder "out"}/bin/pylsp";
118 versionCheckProgramArg = "--version";
119
120 disabledTests = [
121 # avoid dependencies on many Qt things just to run one singular test
122 "test_pyqt_completion"
123
124 # Flaky: ValueError: I/O operation on closed file
125 "test_concurrent_ws_requests"
126
127 # AttributeError: 'NoneType' object has no attribute 'plugin_manager'
128 "test_missing_message"
129 ];
130
131 pythonImportsCheck = [
132 "pylsp"
133 "pylsp.python_lsp"
134 ];
135
136 meta = {
137 description = "Python implementation of the Language Server Protocol";
138 homepage = "https://github.com/python-lsp/python-lsp-server";
139 changelog = "https://github.com/python-lsp/python-lsp-server/blob/v${version}/CHANGELOG.md";
140 license = lib.licenses.mit;
141 maintainers = with lib.maintainers; [ fab ];
142 mainProgram = "pylsp";
143 };
144}