2023-04-29 16:46:19 +00:00
|
|
|
{ lib
|
|
|
|
, stdenv
|
|
|
|
, pythonOlder
|
|
|
|
, buildPythonPackage
|
2023-08-22 20:05:09 +00:00
|
|
|
, fetchFromGitHub
|
2023-04-29 16:46:19 +00:00
|
|
|
, ruff
|
|
|
|
, pygls
|
|
|
|
, lsprotocol
|
|
|
|
, hatchling
|
|
|
|
, typing-extensions
|
2023-10-09 19:29:22 +00:00
|
|
|
, packaging
|
2023-07-15 17:15:38 +00:00
|
|
|
, pytestCheckHook
|
2023-04-29 16:46:19 +00:00
|
|
|
, python-lsp-jsonrpc
|
2023-07-15 17:15:38 +00:00
|
|
|
, pytest-asyncio
|
2023-04-29 16:46:19 +00:00
|
|
|
}:
|
|
|
|
|
|
|
|
buildPythonPackage rec {
|
|
|
|
pname = "ruff-lsp";
|
2024-01-02 11:29:13 +00:00
|
|
|
version = "0.0.48";
|
2023-10-09 19:29:22 +00:00
|
|
|
pyproject = true;
|
2023-04-29 16:46:19 +00:00
|
|
|
disabled = pythonOlder "3.7";
|
|
|
|
|
2023-08-22 20:05:09 +00:00
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "astral-sh";
|
|
|
|
repo = "ruff-lsp";
|
2023-11-16 04:20:00 +00:00
|
|
|
rev = "refs/tags/v${version}";
|
2024-01-02 11:29:13 +00:00
|
|
|
hash = "sha256-X0vCIEfwi4UrDwFYZgEy8XkGdrZQyisx0/ae9MDalG0=";
|
2023-04-29 16:46:19 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
postPatch = ''
|
|
|
|
# ruff binary added to PATH in wrapper so it's not needed
|
|
|
|
sed -i '/"ruff>=/d' pyproject.toml
|
|
|
|
'';
|
|
|
|
|
|
|
|
nativeBuildInputs = [
|
|
|
|
hatchling
|
|
|
|
];
|
|
|
|
|
|
|
|
propagatedBuildInputs = [
|
2023-10-09 19:29:22 +00:00
|
|
|
packaging
|
2023-04-29 16:46:19 +00:00
|
|
|
pygls
|
|
|
|
lsprotocol
|
|
|
|
typing-extensions
|
|
|
|
];
|
|
|
|
|
2023-07-15 17:15:38 +00:00
|
|
|
# fails in linux sandbox
|
2023-04-29 16:46:19 +00:00
|
|
|
doCheck = stdenv.isDarwin;
|
|
|
|
|
|
|
|
nativeCheckInputs = [
|
2023-07-15 17:15:38 +00:00
|
|
|
pytestCheckHook
|
|
|
|
pytest-asyncio
|
2023-04-29 16:46:19 +00:00
|
|
|
python-lsp-jsonrpc
|
|
|
|
ruff
|
|
|
|
];
|
|
|
|
|
|
|
|
makeWrapperArgs = [
|
|
|
|
# prefer ruff from user's PATH, that's usually desired behavior
|
|
|
|
"--suffix PATH : ${lib.makeBinPath [ ruff ]}"
|
|
|
|
|
2023-07-15 17:15:38 +00:00
|
|
|
# Unset ambient PYTHONPATH in the wrapper, so ruff-lsp only ever runs with
|
|
|
|
# its own, isolated set of dependencies. This works because the correct
|
|
|
|
# PYTHONPATH is set in the Python script, which runs after the wrapper.
|
|
|
|
"--unset PYTHONPATH"
|
|
|
|
];
|
2023-04-29 16:46:19 +00:00
|
|
|
|
|
|
|
meta = with lib; {
|
|
|
|
description = "A Language Server Protocol implementation for Ruff";
|
2023-07-15 17:15:38 +00:00
|
|
|
homepage = "https://github.com/astral-sh/ruff-lsp";
|
|
|
|
changelog = "https://github.com/astral-sh/ruff-lsp/releases/tag/v${version}";
|
2023-04-29 16:46:19 +00:00
|
|
|
license = licenses.mit;
|
2023-07-15 17:15:38 +00:00
|
|
|
maintainers = with maintainers; [ figsoda kalekseev ];
|
2023-04-29 16:46:19 +00:00
|
|
|
};
|
|
|
|
}
|