2023-04-29 16:46:19 +00:00
|
|
|
{ lib
|
|
|
|
, pythonOlder
|
|
|
|
, buildPythonPackage
|
|
|
|
, fetchPypi
|
|
|
|
, ruff
|
|
|
|
, lsprotocol
|
|
|
|
, python-lsp-server
|
|
|
|
, tomli
|
|
|
|
}:
|
|
|
|
|
|
|
|
buildPythonPackage rec {
|
|
|
|
pname = "python-lsp-ruff";
|
2023-11-16 04:20:00 +00:00
|
|
|
version = "1.6.0";
|
2023-04-29 16:46:19 +00:00
|
|
|
format = "pyproject";
|
|
|
|
disabled = pythonOlder "3.7";
|
|
|
|
|
|
|
|
src = fetchPypi {
|
|
|
|
inherit version;
|
|
|
|
pname = "python-lsp-ruff";
|
2023-11-16 04:20:00 +00:00
|
|
|
sha256 = "sha256-vf3ZNZyen1W29qk4ST1sus5VTcys9F3067NlUr406bg=";
|
2023-04-29 16:46:19 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
postPatch = ''
|
|
|
|
# ruff binary is used directly, the ruff python package is not needed
|
|
|
|
sed -i '/"ruff>=/d' pyproject.toml
|
|
|
|
sed -i 's|sys.executable, "-m", "ruff"|"${ruff}/bin/ruff"|' pylsp_ruff/plugin.py
|
|
|
|
'';
|
|
|
|
|
|
|
|
propagatedBuildInputs = [
|
|
|
|
lsprotocol
|
|
|
|
python-lsp-server
|
|
|
|
] ++ lib.optionals (pythonOlder "3.11") [
|
|
|
|
tomli
|
|
|
|
];
|
|
|
|
|
|
|
|
doCheck = true;
|
|
|
|
|
|
|
|
meta = with lib; {
|
|
|
|
homepage = "https://github.com/python-lsp/python-lsp-ruff";
|
|
|
|
description = "Ruff linting plugin for pylsp";
|
|
|
|
changelog = "https://github.com/python-lsp/python-lsp-ruff/releases/tag/v${version}";
|
|
|
|
license = licenses.mit;
|
|
|
|
maintainers = with maintainers; [ linsui ];
|
|
|
|
};
|
|
|
|
}
|