19 buildPythonPackage rec {
20 pname = "python-lsp-ruff";
23 disabled = pythonOlder "3.8";
25 src = fetchFromGitHub {
27 repo = "python-lsp-ruff";
28 rev = "refs/tags/v${version}";
29 hash = "sha256-czGA/gl7uoWG9UqYUaY9zER79IKfv7ClqgimgyNCAa4=";
33 # ruff binary is used directly, the ruff python package is not needed
34 sed -i '/"ruff>=/d' pyproject.toml
35 sed -i 's|sys.executable, "-m", "ruff"|"${ruff}/bin/ruff"|' pylsp_ruff/plugin.py
36 sed -i -e '/sys.executable/,+2c"${ruff}/bin/ruff",' -e 's|assert "ruff" in call_args|assert "${ruff}/bin/ruff" in call_args|' tests/test_ruff_lint.py
37 # Nix builds everything in /build/ but ruff somehow doesn't run on files in /build/ and outputs empty results.
38 sed -i -e "s|workspace.root_path|'/tmp/'|g" tests/*.py
45 ] ++ lib.optionals (pythonOlder "3.11") [ tomli ];
47 nativeCheckInputs = [ pytestCheckHook ];
50 homepage = "https://github.com/python-lsp/python-lsp-ruff";
51 description = "Ruff linting plugin for pylsp";
52 changelog = "https://github.com/python-lsp/python-lsp-ruff/releases/tag/v${version}";
53 license = lib.licenses.mit;
54 maintainers = with lib.maintainers; [ linsui ];