depot/third_party/nixpkgs/pkgs/development/python-modules/python-lsp-ruff/default.nix
Default email 9c6ee729d6 Project import generated by Copybara.
GitOrigin-RevId: 6cee3b5893090b0f5f0a06b4cf42ca4e60e5d222
2023-07-15 19:15:38 +02:00

45 lines
1 KiB
Nix

{ lib
, pythonOlder
, buildPythonPackage
, fetchPypi
, ruff
, lsprotocol
, python-lsp-server
, tomli
}:
buildPythonPackage rec {
pname = "python-lsp-ruff";
version = "1.5.1";
format = "pyproject";
disabled = pythonOlder "3.7";
src = fetchPypi {
inherit version;
pname = "python-lsp-ruff";
sha256 = "sha256-yvG4Qn9aym0rTDALURxHrWtDhO7g2VYsI+zLgb8z+gE=";
};
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 ];
};
}