1{
2 lib,
3 stdenv,
4 buildPythonPackage,
5 cargo,
6 darwin,
7 fetchFromGitHub,
8 libiconv,
9 pythonOlder,
10 rustc,
11 rustPlatform,
12 ufmt,
13 usort,
14}:
15
16buildPythonPackage rec {
17 pname = "ruff-api";
18 version = "0.0.6";
19 pyproject = true;
20
21 disabled = pythonOlder "3.8";
22
23 src = fetchFromGitHub {
24 owner = "amyreese";
25 repo = "ruff-api";
26 rev = "refs/tags/v${version}";
27 hash = "sha256-nZKf0LpCoYwWoLDGoorJ+zQSLyuxfWu3LOygocVlYSs=";
28 };
29
30 cargoDeps = rustPlatform.importCargoLock {
31 lockFile = ./Cargo.lock;
32 outputHashes = {
33 "ruff-0.3.7" = "sha256-PS4YJpVut+KtEgSlTVtoVdlu6FVipPIzsl01/Io5N64=";
34 };
35 };
36
37 nativeBuildInputs = [
38 cargo
39 rustPlatform.cargoSetupHook
40 rustPlatform.maturinBuildHook
41 rustc
42 ];
43
44 buildInputs = lib.optionals stdenv.isDarwin [
45 darwin.apple_sdk.frameworks.CoreFoundation
46 darwin.apple_sdk.frameworks.CoreServices
47 libiconv
48 ];
49
50 # Tests have issues at the moment, check with next update
51 doCheck = false;
52
53 pythonImportsCheck = [ "ruff_api" ];
54
55 meta = with lib; {
56 description = "Experimental Python API for Ruff";
57 homepage = "https://github.com/amyreese/ruff-api";
58 changelog = "https://github.com/amyreese/ruff-api/blob/${version}/CHANGELOG.md";
59 license = licenses.mit;
60 maintainers = with maintainers; [ fab ];
61 };
62}