1{ lib
2, stdenv
3, pythonOlder
4, buildPythonPackage
5, fetchPypi
6, ruff
7, pygls
8, lsprotocol
9, hatchling
10, typing-extensions
11, unittestCheckHook
12, python-lsp-jsonrpc
13}:
14
15buildPythonPackage rec {
16 pname = "ruff-lsp";
17 version = "0.0.27";
18 format = "pyproject";
19 disabled = pythonOlder "3.7";
20
21 src = fetchPypi {
22 inherit version;
23 pname = "ruff_lsp";
24 hash = "sha256-Mp5PX87UFUADl/INxZptTsHUBxNpaSRqdsPgRNnLCaQ=";
25 };
26
27 postPatch = ''
28 # ruff binary added to PATH in wrapper so it's not needed
29 sed -i '/"ruff>=/d' pyproject.toml
30 '';
31
32 nativeBuildInputs = [
33 hatchling
34 ];
35
36 propagatedBuildInputs = [
37 pygls
38 lsprotocol
39 typing-extensions
40 ];
41
42 doCheck = stdenv.isDarwin;
43
44 nativeCheckInputs = [
45 unittestCheckHook
46 python-lsp-jsonrpc
47 ruff
48 ];
49
50 makeWrapperArgs = [
51 # prefer ruff from user's PATH, that's usually desired behavior
52 "--suffix PATH : ${lib.makeBinPath [ ruff ]}"
53 ];
54
55
56 meta = with lib; {
57 homepage = "https://github.com/charliermarsh/ruff-lsp";
58 description = "A Language Server Protocol implementation for Ruff";
59 changelog = "https://github.com/charliermarsh/ruff-lsp/releases/tag/v${version}";
60 license = licenses.mit;
61 maintainers = with maintainers; [ kalekseev ];
62 };
63}