2020-09-05 10:47:11 +01:00
|
|
|
{ stdenv, buildPythonPackage, fetchFromGitHub, fetchpatch, pythonOlder, isPy27
|
2019-10-26 20:59:39 +01:00
|
|
|
, backports_functools_lru_cache, configparser, futures, future, jedi, pluggy, python-jsonrpc-server, flake8
|
2020-02-16 08:47:58 +00:00
|
|
|
, pytestCheckHook, mock, pytestcov, coverage, setuptools, ujson
|
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";
|
2020-09-04 14:59:40 +01:00
|
|
|
version = "0.34.1";
|
2018-05-24 11:22:09 +01:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "palantir";
|
|
|
|
repo = "python-language-server";
|
|
|
|
rev = version;
|
2020-09-04 14:59:40 +01:00
|
|
|
sha256 = "sha256-/tVzaoyUO6+7DSvnf3JxpcTY0rU+hHBu5qlru/ZTpxU=";
|
2018-05-24 11:22:09 +01:00
|
|
|
};
|
|
|
|
|
2020-09-05 10:47:11 +01:00
|
|
|
patches = [
|
|
|
|
# https://github.com/palantir/python-language-server/pull/851
|
|
|
|
(fetchpatch {
|
|
|
|
url = "https://github.com/palantir/python-language-server/commit/f513f3297132492dd41e001d943980e6c4f40809.patch";
|
|
|
|
sha256 = "04c9hrb3dzlfchjk4625ipazyfcbq6qq2kj2hg3zf2xsny2jcvi5";
|
|
|
|
})
|
|
|
|
];
|
|
|
|
|
2020-06-16 16:05:13 +01:00
|
|
|
postPatch = ''
|
|
|
|
# https://github.com/palantir/python-jsonrpc-server/issues/36
|
|
|
|
sed -i -e 's!ujson<=!ujson>=!' setup.py
|
|
|
|
'';
|
|
|
|
|
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 = [
|
2020-02-16 08:47:58 +00:00
|
|
|
pytestCheckHook mock pytestcov coverage
|
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"
|
2020-03-20 22:11:30 +00:00
|
|
|
] ++ stdenv.lib.optional isPy27 "test_flake8_lint";
|
2020-02-16 08:47:58 +00:00
|
|
|
|
|
|
|
propagatedBuildInputs = [ setuptools jedi pluggy future python-jsonrpc-server flake8 ujson ]
|
2018-08-06 19:41:52 +01:00
|
|
|
++ stdenv.lib.optional (withProvider "autopep8") autopep8
|
|
|
|
++ stdenv.lib.optional (withProvider "mccabe") mccabe
|
|
|
|
++ stdenv.lib.optional (withProvider "pycodestyle") pycodestyle
|
|
|
|
++ stdenv.lib.optional (withProvider "pydocstyle") pydocstyle
|
|
|
|
++ stdenv.lib.optional (withProvider "pyflakes") pyflakes
|
2019-03-20 22:37:21 +00:00
|
|
|
++ stdenv.lib.optional (withProvider "pylint") pylint
|
2018-08-06 19:41:52 +01:00
|
|
|
++ stdenv.lib.optional (withProvider "rope") rope
|
|
|
|
++ stdenv.lib.optional (withProvider "yapf") yapf
|
|
|
|
++ stdenv.lib.optional isPy27 configparser
|
2019-07-01 22:15:02 +01:00
|
|
|
++ stdenv.lib.optionals (pythonOlder "3.2") [ backports_functools_lru_cache futures ];
|
2018-05-24 11:22:09 +01:00
|
|
|
|
2018-08-06 19:41:52 +01:00
|
|
|
meta = with stdenv.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 ];
|
|
|
|
};
|
|
|
|
}
|