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