2021-01-25 08:26:54 +00:00
|
|
|
{ lib, buildPythonPackage, fetchFromGitHub, pythonOlder, isPy27
|
2021-03-24 16:45:56 +00:00
|
|
|
, backports_functools_lru_cache ? null, configparser ? null, futures ? null, future, jedi, pluggy, python-jsonrpc-server, flake8
|
2021-01-09 05:22:33 +00:00
|
|
|
, pytestCheckHook, mock, pytestcov, coverage, setuptools, ujson, flaky
|
2018-08-06 19:41:52 +01:00
|
|
|
, # Allow building a limited set of providers, e.g. ["pycodestyle"].
|
|
|
|
providers ? ["*"]
|
|
|
|
# The following packages are optional and
|
|
|
|
# can be overwritten with null as your liking.
|
|
|
|
, autopep8 ? null
|
2018-05-24 11:22:09 +01:00
|
|
|
, mccabe ? null
|
|
|
|
, pycodestyle ? null
|
|
|
|
, pydocstyle ? null
|
2018-08-06 19:41:52 +01:00
|
|
|
, pyflakes ? null
|
2019-03-20 22:37:21 +00:00
|
|
|
, pylint ? null
|
2018-08-06 19:41:52 +01:00
|
|
|
, rope ? null
|
|
|
|
, yapf ? null
|
2018-05-24 11:22:09 +01:00
|
|
|
}:
|
|
|
|
|
2018-08-06 19:41:52 +01:00
|
|
|
let
|
|
|
|
withProvider = p: builtins.elem "*" providers || builtins.elem p providers;
|
|
|
|
in
|
|
|
|
|
2018-05-24 11:22:09 +01:00
|
|
|
buildPythonPackage rec {
|
|
|
|
pname = "python-language-server";
|
2021-01-09 05:22:33 +00:00
|
|
|
version = "0.36.2";
|
2018-05-24 11:22:09 +01:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "palantir";
|
|
|
|
repo = "python-language-server";
|
|
|
|
rev = version;
|
2021-01-09 05:22:33 +00:00
|
|
|
sha256 = "07x6jr4z20jxn03bxblwc8vk0ywha492cgwfhj7q97nb5cm7kx0q";
|
2018-05-24 11:22:09 +01:00
|
|
|
};
|
|
|
|
|
2021-04-27 17:18:26 +01:00
|
|
|
postPatch = ''
|
|
|
|
# Reading the changelog I don't expect an API break in pycodestyle and pyflakes
|
|
|
|
substituteInPlace setup.py \
|
|
|
|
--replace "pycodestyle>=2.6.0,<2.7.0" "pycodestyle>=2.6.0,<2.8.0" \
|
|
|
|
--replace "pyflakes>=2.2.0,<2.3.0" "pyflakes>=2.2.0,<2.4.0"
|
|
|
|
'';
|
|
|
|
|
2021-01-16 09:11:29 +00:00
|
|
|
propagatedBuildInputs = [ setuptools jedi pluggy future python-jsonrpc-server ujson ]
|
2021-01-24 00:29:22 +00:00
|
|
|
++ lib.optional (withProvider "autopep8") autopep8
|
|
|
|
++ lib.optional (withProvider "mccabe") mccabe
|
|
|
|
++ lib.optional (withProvider "pycodestyle") pycodestyle
|
|
|
|
++ lib.optional (withProvider "pydocstyle") pydocstyle
|
|
|
|
++ lib.optional (withProvider "pyflakes") pyflakes
|
|
|
|
++ lib.optional (withProvider "pylint") pylint
|
|
|
|
++ lib.optional (withProvider "rope") rope
|
|
|
|
++ lib.optional (withProvider "yapf") yapf
|
|
|
|
++ lib.optional isPy27 configparser
|
|
|
|
++ lib.optionals (pythonOlder "3.2") [ backports_functools_lru_cache futures ];
|
2020-09-05 10:47:11 +01:00
|
|
|
|
2018-08-06 19:41:52 +01:00
|
|
|
# The tests require all the providers, disable otherwise.
|
|
|
|
doCheck = providers == ["*"];
|
|
|
|
|
2018-05-24 11:22:09 +01:00
|
|
|
checkInputs = [
|
2021-01-09 05:22:33 +00:00
|
|
|
pytestCheckHook mock pytestcov coverage flaky
|
2021-01-16 09:11:29 +00:00
|
|
|
# Do not propagate flake8 or it will enable pyflakes implicitly
|
|
|
|
flake8
|
2018-05-24 11:22:09 +01:00
|
|
|
# rope is technically a dependency, but we don't add it by default since we
|
|
|
|
# already have jedi, which is the preferred option
|
|
|
|
rope
|
|
|
|
];
|
2018-08-06 19:41:52 +01:00
|
|
|
|
2020-02-16 08:47:58 +00:00
|
|
|
dontUseSetuptoolsCheck = true;
|
|
|
|
|
|
|
|
preCheck = ''
|
|
|
|
export HOME=$TEMPDIR
|
2018-05-24 11:22:09 +01:00
|
|
|
'';
|
|
|
|
|
2020-02-16 08:47:58 +00:00
|
|
|
# Tests failed since update to 0.31.8
|
|
|
|
disabledTests = [
|
|
|
|
"test_pyqt_completion"
|
|
|
|
"test_numpy_completions"
|
|
|
|
"test_pandas_completions"
|
|
|
|
"test_matplotlib_completions"
|
|
|
|
"test_snippet_parsing"
|
2020-06-16 16:05:13 +01:00
|
|
|
"test_numpy_hover"
|
2021-01-09 05:22:33 +00:00
|
|
|
"test_symbols"
|
2021-01-24 00:29:22 +00:00
|
|
|
] ++ lib.optional isPy27 "test_flake8_lint";
|
2020-02-16 08:47:58 +00:00
|
|
|
|
2021-01-11 07:54:33 +00:00
|
|
|
meta = with lib; {
|
2020-04-01 02:11:51 +01:00
|
|
|
homepage = "https://github.com/palantir/python-language-server";
|
2018-05-24 11:22:09 +01:00
|
|
|
description = "An implementation of the Language Server Protocol for Python";
|
|
|
|
license = licenses.mit;
|
|
|
|
maintainers = [ maintainers.mic92 ];
|
|
|
|
};
|
|
|
|
}
|