1{ lib
2, stdenv
3, autopep8
4, buildPythonPackage
5, docstring-to-markdown
6, fetchFromGitHub
7, flake8
8, flaky
9, jedi
10, matplotlib
11, mccabe
12, numpy
13, pandas
14, pluggy
15, pycodestyle
16, pydocstyle
17, pyflakes
18, pylint
19, pyqt5
20, pytestCheckHook
21, pythonRelaxDepsHook
22, python-lsp-jsonrpc
23, pythonOlder
24, rope
25, setuptools
26, setuptools-scm
27, toml
28, ujson
29, websockets
30, whatthepatch
31, yapf
32}:
33
34buildPythonPackage rec {
35 pname = "python-lsp-server";
36 version = "1.7.2";
37 format = "pyproject";
38
39 disabled = pythonOlder "3.7";
40
41 src = fetchFromGitHub {
42 owner = "python-lsp";
43 repo = pname;
44 rev = "refs/tags/v${version}";
45 hash = "sha256-jsWk2HDDRjOAPGX1K9NqhWkA5xD2fM830z7g7Kee0yQ=";
46 };
47
48 SETUPTOOLS_SCM_PRETEND_VERSION = version;
49
50 postPatch = ''
51 substituteInPlace pyproject.toml \
52 --replace "--cov-report html --cov-report term --junitxml=pytest.xml" "" \
53 --replace "--cov pylsp --cov test" ""
54 '';
55
56 pythonRelaxDeps = [
57 "autopep8"
58 "flake8"
59 "mccabe"
60 "pycodestyle"
61 "pydocstyle"
62 "pyflakes"
63 ];
64
65 nativeBuildInputs = [
66 pythonRelaxDepsHook
67 setuptools-scm
68 ];
69
70 propagatedBuildInputs = [
71 docstring-to-markdown
72 jedi
73 pluggy
74 python-lsp-jsonrpc
75 setuptools # `pkg_resources`imported in pylsp/config/config.py
76 ujson
77 ];
78
79 passthru.optional-dependencies = {
80 all = [
81 autopep8
82 flake8
83 mccabe
84 pycodestyle
85 pydocstyle
86 pyflakes
87 pylint
88 rope
89 toml
90 whatthepatch
91 yapf
92 ];
93 autopep8 = [
94 autopep8
95 ];
96 flake8 = [
97 flake8
98 ];
99 mccabe = [
100 mccabe
101 ];
102 pycodestyle = [
103 pycodestyle
104 ];
105 pydocstyle = [
106 pydocstyle
107 ];
108 pyflakes = [
109 pyflakes
110 ];
111 pylint = [
112 pylint
113 ];
114 rope = [
115 rope
116 ];
117 yapf = [
118 whatthepatch
119 yapf
120 ];
121 websockets = [
122 websockets
123 ];
124 };
125
126 nativeCheckInputs = [
127 flaky
128 matplotlib
129 numpy
130 pandas
131 pytestCheckHook
132 ] ++ passthru.optional-dependencies.all
133 # pyqt5 is broken on aarch64-darwin
134 ++ lib.optionals (!stdenv.isDarwin || !stdenv.isAarch64) [
135 pyqt5
136 ];
137
138 disabledTests = [
139 # Don't run lint tests
140 "test_pydocstyle"
141 # https://github.com/python-lsp/python-lsp-server/issues/243
142 "test_numpy_completions"
143 "test_workspace_loads_pycodestyle_config"
144 ] ++ lib.optionals (stdenv.isDarwin && stdenv.isAarch64) [
145 # pyqt5 is broken on aarch64-darwin
146 "test_pyqt_completion"
147 ];
148
149 preCheck = ''
150 export HOME=$(mktemp -d);
151 '';
152
153 pythonImportsCheck = [
154 "pylsp"
155 "pylsp.python_lsp"
156 ];
157
158 meta = with lib; {
159 description = "Python implementation of the Language Server Protocol";
160 homepage = "https://github.com/python-lsp/python-lsp-server";
161 changelog = "https://github.com/python-lsp/python-lsp-server/blob/v${version}/CHANGELOG.md";
162 license = licenses.mit;
163 maintainers = with maintainers; [ fab ];
164 mainProgram = "pylsp";
165 };
166}