nixpkgs mirror (for testing) github.com/NixOS/nixpkgs
nix
at 22.05 119 lines 3.0 kB view raw
1{ lib 2, autopep8 3, buildPythonPackage 4, fetchFromGitHub 5, flake8 6, flaky 7, jedi 8, matplotlib 9, mccabe 10, numpy 11, pandas 12, pluggy 13, pycodestyle 14, pydocstyle 15, pyflakes 16, pylint 17, pyqt5 18, pytestCheckHook 19, python-lsp-jsonrpc 20, pythonOlder 21, rope 22, setuptools 23, setuptools-scm 24, stdenv 25, ujson 26, yapf 27, withAutopep8 ? true 28, withFlake8 ? true 29, withMccabe ? true 30, withPycodestyle ? true 31, withPydocstyle ? true 32, withPyflakes ? true 33, withPylint ? true 34, withRope ? true 35, withYapf ? true 36}: 37 38buildPythonPackage rec { 39 pname = "python-lsp-server"; 40 version = "1.4.1"; 41 format = "pyproject"; 42 43 disabled = pythonOlder "3.7"; 44 45 src = fetchFromGitHub { 46 owner = "python-lsp"; 47 repo = pname; 48 rev = "v${version}"; 49 sha256 = "sha256-rEfjxHw2NIVIa8RepxLPiXkRFhcGWLzm6w43n60zkFE="; 50 }; 51 52 postPatch = '' 53 substituteInPlace setup.cfg \ 54 --replace "--cov-report html --cov-report term --junitxml=pytest.xml" "" \ 55 --replace "--cov pylsp --cov test" "" \ 56 --replace "mccabe>=0.6.0,<0.7.0" "mccabe" 57 ''; 58 59 preBuild = '' 60 export SETUPTOOLS_SCM_PRETEND_VERSION=${version} 61 ''; 62 63 propagatedBuildInputs = [ 64 jedi 65 pluggy 66 python-lsp-jsonrpc 67 setuptools 68 setuptools-scm 69 ujson 70 ] ++ lib.optional withAutopep8 autopep8 71 ++ lib.optional withFlake8 flake8 72 ++ lib.optional withMccabe mccabe 73 ++ lib.optional withPycodestyle pycodestyle 74 ++ lib.optional withPydocstyle pydocstyle 75 ++ lib.optional withPyflakes pyflakes 76 ++ lib.optional withPylint pylint 77 ++ lib.optional withRope rope 78 ++ lib.optional withYapf yapf; 79 80 checkInputs = [ 81 flaky 82 matplotlib 83 numpy 84 pandas 85 pytestCheckHook 86 ] 87 # pyqt5 is broken on aarch64-darwin 88 ++ lib.optionals (!stdenv.isDarwin || !stdenv.isAarch64) [ pyqt5 ]; 89 90 disabledTests = lib.optional (!withPycodestyle) "test_workspace_loads_pycodestyle_config" 91 # pyqt5 is broken on aarch64-darwin 92 ++ lib.optional (stdenv.isDarwin && stdenv.isAarch64) "test_pyqt_completion"; 93 94 disabledTestPaths = lib.optional (!withAutopep8) "test/plugins/test_autopep8_format.py" 95 ++ lib.optional (!withRope) "test/plugins/test_completion.py" 96 ++ lib.optional (!withFlake8) "test/plugins/test_flake8_lint.py" 97 ++ lib.optional (!withMccabe) "test/plugins/test_mccabe_lint.py" 98 ++ lib.optional (!withPycodestyle) "test/plugins/test_pycodestyle_lint.py" 99 ++ lib.optional (!withPydocstyle) "test/plugins/test_pydocstyle_lint.py" 100 ++ lib.optional (!withPyflakes) "test/plugins/test_pyflakes_lint.py" 101 ++ lib.optional (!withPylint) "test/plugins/test_pylint_lint.py" 102 ++ lib.optional (!withRope) "test/plugins/test_rope_rename.py" 103 ++ lib.optional (!withYapf) "test/plugins/test_yapf_format.py"; 104 105 preCheck = '' 106 export HOME=$(mktemp -d); 107 ''; 108 109 pythonImportsCheck = [ 110 "pylsp" 111 ]; 112 113 meta = with lib; { 114 description = "Python implementation of the Language Server Protocol"; 115 homepage = "https://github.com/python-lsp/python-lsp-server"; 116 license = licenses.mit; 117 maintainers = with maintainers; [ fab ]; 118 }; 119}