Merge pull request #119126 from fabaff/pycomfoconnect
[NixPkgs.git] / pkgs / development / python-modules / python-language-server / default.nix
blobe221f5b1efc11940bde3db33b6ac3d287400c07d
1 { lib, buildPythonPackage, fetchFromGitHub, pythonOlder, isPy27
2 , backports_functools_lru_cache, configparser, futures, future, jedi, pluggy, python-jsonrpc-server, flake8
3 , pytestCheckHook, mock, pytestcov, coverage, setuptools, ujson, flaky
4 , # Allow building a limited set of providers, e.g. ["pycodestyle"].
5   providers ? ["*"]
6   # The following packages are optional and
7   # can be overwritten with null as your liking.
8 , autopep8 ? null
9 , mccabe ? null
10 , pycodestyle ? null
11 , pydocstyle ? null
12 , pyflakes ? null
13 , pylint ? null
14 , rope ? null
15 , yapf ? null
18 let
19   withProvider = p: builtins.elem "*" providers || builtins.elem p providers;
22 buildPythonPackage rec {
23   pname = "python-language-server";
24   version = "0.36.2";
26   src = fetchFromGitHub {
27     owner = "palantir";
28     repo = "python-language-server";
29     rev = version;
30     sha256 = "07x6jr4z20jxn03bxblwc8vk0ywha492cgwfhj7q97nb5cm7kx0q";
31   };
33   propagatedBuildInputs = [ setuptools jedi pluggy future python-jsonrpc-server ujson ]
34     ++ lib.optional (withProvider "autopep8") autopep8
35     ++ lib.optional (withProvider "mccabe") mccabe
36     ++ lib.optional (withProvider "pycodestyle") pycodestyle
37     ++ lib.optional (withProvider "pydocstyle") pydocstyle
38     ++ lib.optional (withProvider "pyflakes") pyflakes
39     ++ lib.optional (withProvider "pylint") pylint
40     ++ lib.optional (withProvider "rope") rope
41     ++ lib.optional (withProvider "yapf") yapf
42     ++ lib.optional isPy27 configparser
43     ++ lib.optionals (pythonOlder "3.2") [ backports_functools_lru_cache futures ];
45   # The tests require all the providers, disable otherwise.
46   doCheck = providers == ["*"];
48   checkInputs = [
49     pytestCheckHook mock pytestcov coverage flaky
50     # Do not propagate flake8 or it will enable pyflakes implicitly
51     flake8
52     # rope is technically a dependency, but we don't add it by default since we
53     # already have jedi, which is the preferred option
54     rope
55   ];
57   dontUseSetuptoolsCheck = true;
59   preCheck = ''
60     export HOME=$TEMPDIR
61   '';
63   # Tests failed since update to 0.31.8
64   disabledTests = [
65     "test_pyqt_completion"
66     "test_numpy_completions"
67     "test_pandas_completions"
68     "test_matplotlib_completions"
69     "test_snippet_parsing"
70     "test_numpy_hover"
71     "test_symbols"
72   ] ++ lib.optional isPy27 "test_flake8_lint";
74   meta = with lib; {
75     homepage = "https://github.com/palantir/python-language-server";
76     description = "An implementation of the Language Server Protocol for Python";
77     license = licenses.mit;
78     maintainers = [ maintainers.mic92 ];
79   };