Merge pull request #307098 from r-ryantm/auto-update/cilium-cli
[NixPkgs.git] / pkgs / development / python-modules / python-lsp-server / default.nix
blobc79e3f7e8d7bcde5e9bdcb45b85c2ba1741356e5
2   lib,
3   stdenv,
4   autopep8,
5   buildPythonPackage,
6   docstring-to-markdown,
7   fetchFromGitHub,
8   flake8,
9   flaky,
10   importlib-metadata,
11   jedi,
12   matplotlib,
13   mccabe,
14   numpy,
15   pandas,
16   pluggy,
17   pycodestyle,
18   pydocstyle,
19   pyflakes,
20   pylint,
21   pyqt5,
22   pytestCheckHook,
23   python-lsp-jsonrpc,
24   pythonOlder,
25   pythonRelaxDepsHook,
26   rope,
27   setuptools,
28   setuptools-scm,
29   toml,
30   ujson,
31   websockets,
32   whatthepatch,
33   yapf,
36 buildPythonPackage rec {
37   pname = "python-lsp-server";
38   version = "1.11.0";
39   format = "pyproject";
41   disabled = pythonOlder "3.8";
43   src = fetchFromGitHub {
44     owner = "python-lsp";
45     repo = "python-lsp-server";
46     rev = "refs/tags/v${version}";
47     hash = "sha256-0DFcnGlyDOK0Lxpr++xV6klhFF9b1fihH5FY/tblr+E=";
48   };
50   postPatch = ''
51     substituteInPlace pyproject.toml \
52       --replace-fail "--cov-report html --cov-report term --junitxml=pytest.xml" "" \
53       --replace-fail "--cov pylsp --cov test" ""
54   '';
56   pythonRelaxDeps = [
57     "autopep8"
58     "flake8"
59     "mccabe"
60     "pycodestyle"
61     "pydocstyle"
62     "pyflakes"
63   ];
65   nativeBuildInputs = [ setuptools-scm ];
67   build-system = [ setuptools-scm ];
69   dependencies = [
70     docstring-to-markdown
71     jedi
72     pluggy
73     python-lsp-jsonrpc
74     setuptools # `pkg_resources`imported in pylsp/config/config.py
75     ujson
76   ] ++ lib.optionals (pythonOlder "3.10") [ importlib-metadata ];
78   passthru.optional-dependencies = {
79     all = [
80       autopep8
81       flake8
82       mccabe
83       pycodestyle
84       pydocstyle
85       pyflakes
86       pylint
87       rope
88       toml
89       whatthepatch
90       yapf
91     ];
92     autopep8 = [ autopep8 ];
93     flake8 = [ flake8 ];
94     mccabe = [ mccabe ];
95     pycodestyle = [ pycodestyle ];
96     pydocstyle = [ pydocstyle ];
97     pyflakes = [ pyflakes ];
98     pylint = [ pylint ];
99     rope = [ rope ];
100     yapf = [
101       whatthepatch
102       yapf
103     ];
104     websockets = [ websockets ];
105   };
107   nativeCheckInputs =
108     [
109       flaky
110       matplotlib
111       numpy
112       pandas
113       pytestCheckHook
114     ]
115     ++ passthru.optional-dependencies.all
116     # pyqt5 is broken on aarch64-darwin
117     ++ lib.optionals (!stdenv.isDarwin || !stdenv.isAarch64) [ pyqt5 ];
119   disabledTests =
120     [
121       # Don't run lint tests
122       "test_pydocstyle"
123       # https://github.com/python-lsp/python-lsp-server/issues/243
124       "test_numpy_completions"
125       "test_workspace_loads_pycodestyle_config"
126       "test_autoimport_code_actions_and_completions_for_notebook_document"
127     ]
128     ++ lib.optionals (stdenv.isDarwin && stdenv.isAarch64) [
129       # pyqt5 is broken on aarch64-darwin
130       "test_pyqt_completion"
131     ];
133   preCheck = ''
134     export HOME=$(mktemp -d);
135   '';
137   pythonImportsCheck = [
138     "pylsp"
139     "pylsp.python_lsp"
140   ];
142   meta = with lib; {
143     description = "Python implementation of the Language Server Protocol";
144     homepage = "https://github.com/python-lsp/python-lsp-server";
145     changelog = "https://github.com/python-lsp/python-lsp-server/blob/v${version}/CHANGELOG.md";
146     license = licenses.mit;
147     maintainers = with maintainers; [ fab ];
148     mainProgram = "pylsp";
149   };