about summary refs log tree commit diff
path: root/nixpkgs/pkgs/development/python-modules/python-lsp-server/default.nix
blob: b000379dd1bbaef18b3b76b2b227d26ee123fe38 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
{ lib
, autopep8
, buildPythonPackage
, fetchFromGitHub
, flake8
, flaky
, jedi
, matplotlib
, mccabe
, numpy
, pandas
, pluggy
, pycodestyle
, pydocstyle
, pyflakes
, pylint
, pyqt5
, pytestCheckHook
, python-lsp-jsonrpc
, pythonOlder
, rope
, setuptools
, ujson
, yapf
, withAutopep8 ? true
, withFlake8 ? true
, withMccabe ? true
, withPycodestyle ? true
, withPydocstyle ? true
, withPyflakes ? true
, withPylint ? true
, withRope ? true
, withYapf ? true
}:

buildPythonPackage rec {
  pname = "python-lsp-server";
  version = "1.3.3";

  disabled = pythonOlder "3.7";

  src = fetchFromGitHub {
    owner = "python-lsp";
    repo = pname;
    rev = "v${version}";
    sha256 = "sha256-F8f9NAjPWkm01D/KwFH0oA6nQ3EF4ZVCCckZTL4A35Y=";
  };

  postPatch = ''
    substituteInPlace setup.cfg \
      --replace "--cov-report html --cov-report term --junitxml=pytest.xml" "" \
      --replace "--cov pylsp --cov test" ""
  '';

  propagatedBuildInputs = [
    jedi
    pluggy
    python-lsp-jsonrpc
    setuptools
    ujson
  ] ++ lib.optional withAutopep8 autopep8
  ++ 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
  ++ lib.optional withYapf yapf;

  checkInputs = [
    flaky
    matplotlib
    numpy
    pandas
    pyqt5
    pytestCheckHook
  ];

  disabledTests = [
    # pytlint output changed
    "test_lint_free_pylint"
  ] ++ lib.optional (!withPycodestyle) "test_workspace_loads_pycodestyle_config";

  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";

  preCheck = ''
    export HOME=$(mktemp -d);
  '';

  pythonImportsCheck = [
    "pylsp"
  ];

  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 ];
  };
}