2021-07-04 02:40:35 +00:00
|
|
|
{ lib
|
|
|
|
, autopep8
|
|
|
|
, buildPythonPackage
|
|
|
|
, fetchFromGitHub
|
|
|
|
, flake8
|
|
|
|
, flaky
|
|
|
|
, jedi
|
|
|
|
, matplotlib
|
|
|
|
, mccabe
|
|
|
|
, numpy
|
|
|
|
, pandas
|
|
|
|
, pluggy
|
|
|
|
, pycodestyle
|
|
|
|
, pydocstyle
|
|
|
|
, pyflakes
|
|
|
|
, pylint
|
|
|
|
, pyqt5
|
|
|
|
, pytestCheckHook
|
|
|
|
, python-lsp-jsonrpc
|
|
|
|
, pythonOlder
|
|
|
|
, rope
|
2021-07-16 19:40:57 +00:00
|
|
|
, setuptools
|
2022-05-18 14:49:53 +00:00
|
|
|
, setuptools-scm
|
2022-02-10 20:34:41 +00:00
|
|
|
, stdenv
|
2021-07-04 02:40:35 +00:00
|
|
|
, ujson
|
2022-08-12 12:06:08 +00:00
|
|
|
, whatthepatch
|
2021-07-04 02:40:35 +00:00
|
|
|
, yapf
|
2021-08-23 08:02:39 +00:00
|
|
|
, withAutopep8 ? true
|
|
|
|
, withFlake8 ? true
|
|
|
|
, withMccabe ? true
|
|
|
|
, withPycodestyle ? true
|
|
|
|
, withPydocstyle ? true
|
|
|
|
, withPyflakes ? true
|
|
|
|
, withPylint ? true
|
|
|
|
, withRope ? true
|
|
|
|
, withYapf ? true
|
2021-07-04 02:40:35 +00:00
|
|
|
}:
|
|
|
|
|
|
|
|
buildPythonPackage rec {
|
|
|
|
pname = "python-lsp-server";
|
2022-08-12 12:06:08 +00:00
|
|
|
version = "1.5.0";
|
2022-05-18 14:49:53 +00:00
|
|
|
format = "pyproject";
|
2022-01-03 16:56:52 +00:00
|
|
|
|
|
|
|
disabled = pythonOlder "3.7";
|
2021-07-04 02:40:35 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "python-lsp";
|
|
|
|
repo = pname;
|
2022-08-12 12:06:08 +00:00
|
|
|
rev = "refs/tags/v${version}";
|
|
|
|
sha256 = "sha256-tW2w94HI6iy8vcDb5pIL79bAO6BJp9q6SMAXgiVobm0=";
|
2021-07-04 02:40:35 +00:00
|
|
|
};
|
|
|
|
|
2021-09-18 10:52:07 +00:00
|
|
|
postPatch = ''
|
2022-08-12 12:06:08 +00:00
|
|
|
substituteInPlace pyproject.toml \
|
2021-09-18 10:52:07 +00:00
|
|
|
--replace "--cov-report html --cov-report term --junitxml=pytest.xml" "" \
|
2022-05-18 14:49:53 +00:00
|
|
|
--replace "--cov pylsp --cov test" "" \
|
|
|
|
--replace "mccabe>=0.6.0,<0.7.0" "mccabe"
|
|
|
|
'';
|
|
|
|
|
|
|
|
preBuild = ''
|
|
|
|
export SETUPTOOLS_SCM_PRETEND_VERSION=${version}
|
2021-09-18 10:52:07 +00:00
|
|
|
'';
|
|
|
|
|
2021-07-04 02:40:35 +00:00
|
|
|
propagatedBuildInputs = [
|
|
|
|
jedi
|
|
|
|
pluggy
|
|
|
|
python-lsp-jsonrpc
|
2021-07-16 19:40:57 +00:00
|
|
|
setuptools
|
2022-05-18 14:49:53 +00:00
|
|
|
setuptools-scm
|
2021-07-04 02:40:35 +00:00
|
|
|
ujson
|
2021-08-23 08:02:39 +00:00
|
|
|
] ++ lib.optional withAutopep8 autopep8
|
2021-09-18 10:52:07 +00:00
|
|
|
++ lib.optional withFlake8 flake8
|
|
|
|
++ lib.optional withMccabe mccabe
|
|
|
|
++ lib.optional withPycodestyle pycodestyle
|
|
|
|
++ lib.optional withPydocstyle pydocstyle
|
|
|
|
++ lib.optional withPyflakes pyflakes
|
|
|
|
++ lib.optional withPylint pylint
|
|
|
|
++ lib.optional withRope rope
|
2022-08-12 12:06:08 +00:00
|
|
|
++ lib.optionals withYapf [ whatthepatch yapf ];
|
2021-07-04 02:40:35 +00:00
|
|
|
|
|
|
|
checkInputs = [
|
|
|
|
flaky
|
|
|
|
matplotlib
|
|
|
|
numpy
|
|
|
|
pandas
|
|
|
|
pytestCheckHook
|
2022-02-10 20:34:41 +00:00
|
|
|
]
|
|
|
|
# pyqt5 is broken on aarch64-darwin
|
|
|
|
++ lib.optionals (!stdenv.isDarwin || !stdenv.isAarch64) [ pyqt5 ];
|
2021-07-04 02:40:35 +00:00
|
|
|
|
2022-08-12 12:06:08 +00:00
|
|
|
disabledTests = [
|
|
|
|
"test_numpy_completions" # https://github.com/python-lsp/python-lsp-server/issues/243
|
|
|
|
] ++ lib.optional (!withPycodestyle) "test_workspace_loads_pycodestyle_config"
|
2022-02-10 20:34:41 +00:00
|
|
|
# pyqt5 is broken on aarch64-darwin
|
|
|
|
++ lib.optional (stdenv.isDarwin && stdenv.isAarch64) "test_pyqt_completion";
|
2021-08-23 08:02:39 +00:00
|
|
|
|
|
|
|
disabledTestPaths = lib.optional (!withAutopep8) "test/plugins/test_autopep8_format.py"
|
|
|
|
++ lib.optional (!withRope) "test/plugins/test_completion.py"
|
|
|
|
++ lib.optional (!withFlake8) "test/plugins/test_flake8_lint.py"
|
|
|
|
++ lib.optional (!withMccabe) "test/plugins/test_mccabe_lint.py"
|
|
|
|
++ lib.optional (!withPycodestyle) "test/plugins/test_pycodestyle_lint.py"
|
|
|
|
++ lib.optional (!withPydocstyle) "test/plugins/test_pydocstyle_lint.py"
|
|
|
|
++ lib.optional (!withPyflakes) "test/plugins/test_pyflakes_lint.py"
|
|
|
|
++ lib.optional (!withPylint) "test/plugins/test_pylint_lint.py"
|
|
|
|
++ lib.optional (!withRope) "test/plugins/test_rope_rename.py"
|
|
|
|
++ lib.optional (!withYapf) "test/plugins/test_yapf_format.py";
|
|
|
|
|
2021-07-04 02:40:35 +00:00
|
|
|
preCheck = ''
|
|
|
|
export HOME=$(mktemp -d);
|
|
|
|
'';
|
|
|
|
|
2022-01-03 16:56:52 +00:00
|
|
|
pythonImportsCheck = [
|
|
|
|
"pylsp"
|
|
|
|
];
|
2021-07-04 02:40:35 +00:00
|
|
|
|
|
|
|
meta = with lib; {
|
|
|
|
description = "Python implementation of the Language Server Protocol";
|
|
|
|
homepage = "https://github.com/python-lsp/python-lsp-server";
|
|
|
|
license = licenses.mit;
|
|
|
|
maintainers = with maintainers; [ fab ];
|
|
|
|
};
|
|
|
|
}
|