1{ lib
2, pythonOlder
3, buildPythonPackage
4, fetchPypi
5, ruff
6, lsprotocol
7, python-lsp-server
8, tomli
9}:
10
11buildPythonPackage rec {
12 pname = "python-lsp-ruff";
13 version = "1.6.0";
14 format = "pyproject";
15 disabled = pythonOlder "3.7";
16
17 src = fetchPypi {
18 inherit version;
19 pname = "python-lsp-ruff";
20 sha256 = "sha256-vf3ZNZyen1W29qk4ST1sus5VTcys9F3067NlUr406bg=";
21 };
22
23 postPatch = ''
24 # ruff binary is used directly, the ruff python package is not needed
25 sed -i '/"ruff>=/d' pyproject.toml
26 sed -i 's|sys.executable, "-m", "ruff"|"${ruff}/bin/ruff"|' pylsp_ruff/plugin.py
27 '';
28
29 propagatedBuildInputs = [
30 lsprotocol
31 python-lsp-server
32 ] ++ lib.optionals (pythonOlder "3.11") [
33 tomli
34 ];
35
36 doCheck = true;
37
38 meta = with lib; {
39 homepage = "https://github.com/python-lsp/python-lsp-ruff";
40 description = "Ruff linting plugin for pylsp";
41 changelog = "https://github.com/python-lsp/python-lsp-ruff/releases/tag/v${version}";
42 license = licenses.mit;
43 maintainers = with maintainers; [ linsui ];
44 };
45}