Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
at 20.03 65 lines 2.2 kB view raw
1{ stdenv, buildPythonPackage, fetchFromGitHub, pythonOlder, isPy27 2, backports_functools_lru_cache, configparser, futures, future, jedi, pluggy, python-jsonrpc-server, flake8 3, pytest, mock, pytestcov, coverage, setuptools 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.29.1"; 25 26 src = fetchFromGitHub { 27 owner = "palantir"; 28 repo = "python-language-server"; 29 rev = version; 30 sha256 = "0hsp0h8vma8z6f0mg311hp59h6hayl7zzxmy295x5fl2l9iiakfv"; 31 }; 32 33 # The tests require all the providers, disable otherwise. 34 doCheck = providers == ["*"]; 35 36 checkInputs = [ 37 pytest mock pytestcov coverage 38 # rope is technically a dependency, but we don't add it by default since we 39 # already have jedi, which is the preferred option 40 rope 41 ]; 42 43 checkPhase = '' 44 HOME=$TEMPDIR pytest 45 ''; 46 47 propagatedBuildInputs = [ setuptools jedi pluggy future python-jsonrpc-server flake8 ] 48 ++ stdenv.lib.optional (withProvider "autopep8") autopep8 49 ++ stdenv.lib.optional (withProvider "mccabe") mccabe 50 ++ stdenv.lib.optional (withProvider "pycodestyle") pycodestyle 51 ++ stdenv.lib.optional (withProvider "pydocstyle") pydocstyle 52 ++ stdenv.lib.optional (withProvider "pyflakes") pyflakes 53 ++ stdenv.lib.optional (withProvider "pylint") pylint 54 ++ stdenv.lib.optional (withProvider "rope") rope 55 ++ stdenv.lib.optional (withProvider "yapf") yapf 56 ++ stdenv.lib.optional isPy27 configparser 57 ++ stdenv.lib.optionals (pythonOlder "3.2") [ backports_functools_lru_cache futures ]; 58 59 meta = with stdenv.lib; { 60 homepage = https://github.com/palantir/python-language-server; 61 description = "An implementation of the Language Server Protocol for Python"; 62 license = licenses.mit; 63 maintainers = [ maintainers.mic92 ]; 64 }; 65}