1{ lib
2, autopep8
3, buildPythonPackage
4, fetchFromGitHub
5, flake8
6, flaky
7, jedi
8, matplotlib
9, mccabe
10, numpy
11, pandas
12, pluggy
13, pycodestyle
14, pydocstyle
15, pyflakes
16, pylint
17, pyqt5
18, pytestCheckHook
19, python-lsp-jsonrpc
20, pythonOlder
21, rope
22, setuptools
23, ujson
24, yapf
25, withAutopep8 ? true
26, withFlake8 ? true
27, withMccabe ? true
28, withPycodestyle ? true
29, withPydocstyle ? true
30, withPyflakes ? true
31, withPylint ? true
32, withRope ? true
33, withYapf ? true
34}:
35
36buildPythonPackage rec {
37 pname = "python-lsp-server";
38 version = "1.2.4";
39 disabled = pythonOlder "3.6";
40
41 src = fetchFromGitHub {
42 owner = "python-lsp";
43 repo = pname;
44 rev = "v${version}";
45 sha256 = "0c1g46hpzjhqbjcmv6xm3by3jprcjhzjslqzrp95hdkbykvrgs5x";
46 };
47
48 postPatch = ''
49 substituteInPlace setup.cfg \
50 --replace "--cov-report html --cov-report term --junitxml=pytest.xml" "" \
51 --replace "--cov pylsp --cov test" ""
52 '';
53
54 propagatedBuildInputs = [
55 jedi
56 pluggy
57 python-lsp-jsonrpc
58 setuptools
59 ujson
60 ] ++ lib.optional withAutopep8 autopep8
61 ++ lib.optional withFlake8 flake8
62 ++ lib.optional withMccabe mccabe
63 ++ lib.optional withPycodestyle pycodestyle
64 ++ lib.optional withPydocstyle pydocstyle
65 ++ lib.optional withPyflakes pyflakes
66 ++ lib.optional withPylint pylint
67 ++ lib.optional withRope rope
68 ++ lib.optional withYapf yapf;
69
70 checkInputs = [
71 flaky
72 matplotlib
73 numpy
74 pandas
75 pyqt5
76 pytestCheckHook
77 ];
78
79 disabledTests = [
80 # pytlint output changed
81 "test_lint_free_pylint"
82 ] ++ lib.optional (!withPycodestyle) "test_workspace_loads_pycodestyle_config";
83
84 disabledTestPaths = lib.optional (!withAutopep8) "test/plugins/test_autopep8_format.py"
85 ++ lib.optional (!withRope) "test/plugins/test_completion.py"
86 ++ lib.optional (!withFlake8) "test/plugins/test_flake8_lint.py"
87 ++ lib.optional (!withMccabe) "test/plugins/test_mccabe_lint.py"
88 ++ lib.optional (!withPycodestyle) "test/plugins/test_pycodestyle_lint.py"
89 ++ lib.optional (!withPydocstyle) "test/plugins/test_pydocstyle_lint.py"
90 ++ lib.optional (!withPyflakes) "test/plugins/test_pyflakes_lint.py"
91 ++ lib.optional (!withPylint) "test/plugins/test_pylint_lint.py"
92 ++ lib.optional (!withRope) "test/plugins/test_rope_rename.py"
93 ++ lib.optional (!withYapf) "test/plugins/test_yapf_format.py";
94
95 preCheck = ''
96 export HOME=$(mktemp -d);
97 '';
98
99 pythonImportsCheck = [ "pylsp" ];
100
101 meta = with lib; {
102 description = "Python implementation of the Language Server Protocol";
103 homepage = "https://github.com/python-lsp/python-lsp-server";
104 license = licenses.mit;
105 maintainers = with maintainers; [ fab ];
106 };
107}