1{ lib, buildPythonPackage, fetchFromGitHub, pythonAtLeast, pythonOlder, isPy27 2, backports_functools_lru_cache ? null, configparser ? null, futures ? null, future, jedi, pluggy, python-jsonrpc-server, flake8 3, pytestCheckHook, mock, pytest-cov, coverage, setuptools, ujson, flaky 4, # Allow building a limited set of providers, e.g. ["pycodestyle"]. 5 providers ? ["*"] 6 # The following packages are optional and 7 # can be overwritten with null as your liking. 8, autopep8 ? null 9, mccabe ? null 10, pycodestyle ? null 11, pydocstyle ? null 12, pyflakes ? null 13, pylint ? null 14, rope ? null 15, yapf ? null 16}: 17 18let 19 withProvider = p: builtins.elem "*" providers || builtins.elem p providers; 20in 21 22buildPythonPackage rec { 23 pname = "python-language-server"; 24 version = "0.36.2"; 25 # https://github.com/palantir/python-language-server/issues/896#issuecomment-752790868 26 disabled = pythonAtLeast "3.9"; 27 28 src = fetchFromGitHub { 29 owner = "palantir"; 30 repo = "python-language-server"; 31 rev = version; 32 sha256 = "07x6jr4z20jxn03bxblwc8vk0ywha492cgwfhj7q97nb5cm7kx0q"; 33 }; 34 35 postPatch = '' 36 # Reading the changelog I don't expect an API break in pycodestyle and pyflakes 37 substituteInPlace setup.py \ 38 --replace "pycodestyle>=2.6.0,<2.7.0" "pycodestyle>=2.6.0,<2.8.0" \ 39 --replace "jedi>=0.17.2,<0.18.0" "jedi>=0.17.2,<0.19.0" \ 40 --replace "pyflakes>=2.2.0,<2.3.0" "pyflakes>=2.2.0,<2.4.0" 41 ''; 42 43 propagatedBuildInputs = [ setuptools jedi pluggy future python-jsonrpc-server ujson ] 44 ++ lib.optional (withProvider "autopep8") autopep8 45 ++ lib.optional (withProvider "mccabe") mccabe 46 ++ lib.optional (withProvider "pycodestyle") pycodestyle 47 ++ lib.optional (withProvider "pydocstyle") pydocstyle 48 ++ lib.optional (withProvider "pyflakes") pyflakes 49 ++ lib.optional (withProvider "pylint") pylint 50 ++ lib.optional (withProvider "rope") rope 51 ++ lib.optional (withProvider "yapf") yapf 52 ++ lib.optional isPy27 configparser 53 ++ lib.optionals (pythonOlder "3.2") [ backports_functools_lru_cache futures ]; 54 55 # The tests require all the providers, disable otherwise. 56 doCheck = providers == ["*"]; 57 58 checkInputs = [ 59 pytestCheckHook mock pytest-cov coverage flaky 60 # Do not propagate flake8 or it will enable pyflakes implicitly 61 flake8 62 # rope is technically a dependency, but we don't add it by default since we 63 # already have jedi, which is the preferred option 64 rope 65 ]; 66 67 dontUseSetuptoolsCheck = true; 68 69 preCheck = '' 70 export HOME=$TEMPDIR 71 ''; 72 73 # Tests failed since update to 0.31.8 74 disabledTests = [ 75 "test_pyqt_completion" 76 "test_numpy_completions" 77 "test_pandas_completions" 78 "test_matplotlib_completions" 79 "test_snippet_parsing" 80 "test_numpy_hover" 81 "test_symbols" 82 ] ++ lib.optional isPy27 "test_flake8_lint"; 83 84 meta = with lib; { 85 homepage = "https://github.com/palantir/python-language-server"; 86 description = "An implementation of the Language Server Protocol for Python"; 87 license = licenses.mit; 88 maintainers = [ ]; 89 # no longer maintained 90 # see https://github.com/palantir/python-language-server/pull/918#issuecomment-817361554 91 broken = true; 92 }; 93}