2024-09-19 14:19:46 +00:00
|
|
|
{
|
|
|
|
lib,
|
|
|
|
stdenv,
|
|
|
|
python3,
|
|
|
|
fetchFromGitHub,
|
|
|
|
|
|
|
|
# nativeCheckInputs
|
|
|
|
ruff,
|
|
|
|
|
|
|
|
# passthru
|
|
|
|
nix-update-script,
|
|
|
|
testers,
|
|
|
|
ruff-lsp,
|
2023-04-29 16:46:19 +00:00
|
|
|
}:
|
|
|
|
|
2024-09-19 14:19:46 +00:00
|
|
|
python3.pkgs.buildPythonApplication rec {
|
2023-04-29 16:46:19 +00:00
|
|
|
pname = "ruff-lsp";
|
2024-09-26 11:04:55 +00:00
|
|
|
version = "0.0.57";
|
2023-10-09 19:29:22 +00:00
|
|
|
pyproject = true;
|
2023-04-29 16:46:19 +00:00
|
|
|
|
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-09-26 11:04:55 +00:00
|
|
|
hash = "sha256-w9NNdsDD+YLrCw8DHDhVx62MdwLhcN8QSmb/2rqlb5g=";
|
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
|
|
|
|
'';
|
|
|
|
|
2024-09-19 14:19:46 +00:00
|
|
|
build-system = with python3.pkgs; [ hatchling ];
|
2023-04-29 16:46:19 +00:00
|
|
|
|
2024-09-19 14:19:46 +00:00
|
|
|
dependencies = with python3.pkgs; [
|
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
|
2024-09-26 11:04:55 +00:00
|
|
|
doCheck = stdenv.hostPlatform.isDarwin;
|
2023-04-29 16:46:19 +00:00
|
|
|
|
2024-09-19 14:19:46 +00:00
|
|
|
nativeCheckInputs = with python3.pkgs; [
|
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
|
|
|
|
2024-09-19 14:19:46 +00:00
|
|
|
passthru = {
|
|
|
|
updateScript = nix-update-script { };
|
|
|
|
tests.version = testers.testVersion { package = ruff-lsp; };
|
|
|
|
};
|
|
|
|
|
2024-07-27 06:49:29 +00:00
|
|
|
meta = {
|
2024-02-07 01:22:34 +00:00
|
|
|
changelog = "https://github.com/astral-sh/ruff-lsp/releases/tag/v${version}";
|
2024-06-20 14:57:18 +00:00
|
|
|
description = "Language Server Protocol implementation for Ruff";
|
2023-07-15 17:15:38 +00:00
|
|
|
homepage = "https://github.com/astral-sh/ruff-lsp";
|
2024-07-27 06:49:29 +00:00
|
|
|
license = lib.licenses.mit;
|
2024-02-07 01:22:34 +00:00
|
|
|
mainProgram = "ruff-lsp";
|
2024-09-19 14:19:46 +00:00
|
|
|
maintainers = with lib.maintainers; [
|
|
|
|
figsoda
|
|
|
|
kalekseev
|
|
|
|
];
|
2023-04-29 16:46:19 +00:00
|
|
|
};
|
|
|
|
}
|