Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
1{ 2 lib, 3 stdenv, 4 autopep8, 5 buildPythonPackage, 6 docstring-to-markdown, 7 fetchFromGitHub, 8 flake8, 9 flaky, 10 importlib-metadata, 11 jedi, 12 matplotlib, 13 mccabe, 14 numpy, 15 pandas, 16 pluggy, 17 pycodestyle, 18 pydocstyle, 19 pyflakes, 20 pylint, 21 pytestCheckHook, 22 python-lsp-jsonrpc, 23 pythonOlder, 24 rope, 25 setuptools, 26 setuptools-scm, 27 toml, 28 ujson, 29 websockets, 30 whatthepatch, 31 yapf, 32}: 33 34buildPythonPackage rec { 35 pname = "python-lsp-server"; 36 version = "1.11.0"; 37 format = "pyproject"; 38 39 disabled = pythonOlder "3.8"; 40 41 src = fetchFromGitHub { 42 owner = "python-lsp"; 43 repo = "python-lsp-server"; 44 rev = "refs/tags/v${version}"; 45 hash = "sha256-0DFcnGlyDOK0Lxpr++xV6klhFF9b1fihH5FY/tblr+E="; 46 }; 47 48 postPatch = '' 49 substituteInPlace pyproject.toml \ 50 --replace-fail "--cov-report html --cov-report term --junitxml=pytest.xml" "" \ 51 --replace-fail "--cov pylsp --cov test" "" 52 ''; 53 54 pythonRelaxDeps = [ 55 "autopep8" 56 "flake8" 57 "mccabe" 58 "pycodestyle" 59 "pydocstyle" 60 "pyflakes" 61 ]; 62 63 nativeBuildInputs = [ setuptools-scm ]; 64 65 build-system = [ setuptools-scm ]; 66 67 dependencies = [ 68 docstring-to-markdown 69 jedi 70 pluggy 71 python-lsp-jsonrpc 72 setuptools # `pkg_resources`imported in pylsp/config/config.py 73 ujson 74 ] ++ lib.optionals (pythonOlder "3.10") [ importlib-metadata ]; 75 76 passthru.optional-dependencies = { 77 all = [ 78 autopep8 79 flake8 80 mccabe 81 pycodestyle 82 pydocstyle 83 pyflakes 84 pylint 85 rope 86 toml 87 whatthepatch 88 yapf 89 ]; 90 autopep8 = [ autopep8 ]; 91 flake8 = [ flake8 ]; 92 mccabe = [ mccabe ]; 93 pycodestyle = [ pycodestyle ]; 94 pydocstyle = [ pydocstyle ]; 95 pyflakes = [ pyflakes ]; 96 pylint = [ pylint ]; 97 rope = [ rope ]; 98 yapf = [ 99 whatthepatch 100 yapf 101 ]; 102 websockets = [ websockets ]; 103 }; 104 105 nativeCheckInputs = 106 [ 107 flaky 108 matplotlib 109 numpy 110 pandas 111 pytestCheckHook 112 ] 113 ++ passthru.optional-dependencies.all; 114 115 disabledTests = 116 [ 117 # Don't run lint tests 118 "test_pydocstyle" 119 # https://github.com/python-lsp/python-lsp-server/issues/243 120 "test_numpy_completions" 121 "test_workspace_loads_pycodestyle_config" 122 "test_autoimport_code_actions_and_completions_for_notebook_document" 123 # avoid dependencies on many Qt things just to run one singular test 124 "test_pyqt_completion" 125 ]; 126 127 preCheck = '' 128 export HOME=$(mktemp -d); 129 ''; 130 131 pythonImportsCheck = [ 132 "pylsp" 133 "pylsp.python_lsp" 134 ]; 135 136 meta = with lib; { 137 description = "Python implementation of the Language Server Protocol"; 138 homepage = "https://github.com/python-lsp/python-lsp-server"; 139 changelog = "https://github.com/python-lsp/python-lsp-server/blob/v${version}/CHANGELOG.md"; 140 license = licenses.mit; 141 maintainers = with maintainers; [ fab ]; 142 mainProgram = "pylsp"; 143 }; 144}